Skip to content

Add @skip-<dbtype> tags for database-specific test exclusion#302

Merged
swissspidy merged 3 commits intomainfrom
copilot/add-skip-dbtype-tags
Feb 8, 2026
Merged

Add @skip-<dbtype> tags for database-specific test exclusion#302
swissspidy merged 3 commits intomainfrom
copilot/add-skip-dbtype-tags

Conversation

Copy link
Contributor

Copilot AI commented Feb 8, 2026

Adds support for @skip-mysql, @skip-mariadb, and @skip-sqlite Behat tags to skip scenarios based on the active database type.

Implementation

  • utils/behat-tags.php: Adds skip tags to the exclusion list based on detected database type, mirroring the existing @require-<dbtype> pattern
  • tests/tests/TestBehatTags.php: Updates test expectations and adds test_behat_tags_skip_db_type() coverage
  • features/testing.feature: Adds example scenarios demonstrating each skip tag

Usage

@skip-mysql
Scenario: SQLite-specific behavior
  Given a WP install
  When I run `wp db query "PRAGMA table_info(wp_posts)"`
  Then STDOUT should contain "sqlite"

@skip-sqlite  
Scenario: Requires traditional RDBMS
  Given a WP install
  When I run `wp db query "SHOW TABLES"`
  Then STDOUT should contain "wp_posts"

The skip tags are applied unconditionally when the behat-tags.php script detects the active database type, complementing the existing require tags for more flexible test control.

Original prompt

This section details on the original issue you should resolve

<issue_title>Add skip-<dbtype> tags</issue_title>
<issue_description>Would be nice to support @skip-mysql, @skip-mariadb, @skip-sqlite behat tags, makes things a bit easier.</issue_description>

Comments on the Issue (you are @copilot in this section)


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 2 commits February 8, 2026 15:28
- Updated utils/behat-tags.php to add skip tags based on database type
- Updated all test cases in tests/tests/TestBehatTags.php to expect new skip tags
- Added new test method test_behat_tags_skip_db_type to specifically test the skip tags

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
…ing.feature

Co-authored-by: swissspidy <841956+swissspidy@users.noreply.github.com>
Copilot AI changed the title [WIP] Add skip-mysql, skip-mariadb, and skip-sqlite tags Add @skip-<dbtype> tags for database-specific test exclusion Feb 8, 2026
Copilot AI requested a review from swissspidy February 8, 2026 15:31
@codecov
Copy link

codecov bot commented Feb 8, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@swissspidy swissspidy marked this pull request as ready for review February 8, 2026 15:51
@swissspidy swissspidy requested a review from a team as a code owner February 8, 2026 15:51
Copilot AI review requested due to automatic review settings February 8, 2026 15:51
@swissspidy swissspidy added this to the 5.0.10 milestone Feb 8, 2026
@swissspidy swissspidy merged commit 26313e2 into main Feb 8, 2026
57 checks passed
@swissspidy swissspidy deleted the copilot/add-skip-dbtype-tags branch February 8, 2026 15:51
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds support for database-specific Behat skip tags (@skip-mysql, @skip-mariadb, @skip-sqlite) so scenarios can be excluded automatically based on the active DB engine, complementing the existing @require-* tagging.

Changes:

  • Extend utils/behat-tags.php to emit DB-type-specific skip exclusions (~@skip-<dbtype>) for the active database.
  • Update PHPUnit expectations and add a dedicated unit test covering the new skip-tag output.
  • Add Behat feature examples demonstrating each @skip-* tag.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
utils/behat-tags.php Adds @skip-<dbtype> tags to the generated exclusion list for the active DB type.
tests/tests/TestBehatTags.php Updates expected tag expressions and adds test_behat_tags_skip_db_type() coverage.
features/testing.feature Adds example scenarios tagged with @skip-mysql, @skip-mariadb, and @skip-sqlite.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +279 to +280
file_put_contents( $this->temp_dir . '/features/skip_db.feature', '@skip-mysql @skip-mariadb @skip-sqlite' );

Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

behat-tags.php adds the DB-specific @skip-* exclusions unconditionally based on the active DB type; this test doesn’t need to write a feature file containing @skip-* tags for the output to change. Consider removing this file_put_contents() (or adding a brief comment explaining why it’s needed) to avoid implying the script parses @skip-* tags from feature files.

Suggested change
file_put_contents( $this->temp_dir . '/features/skip_db.feature', '@skip-mysql @skip-mariadb @skip-sqlite' );

Copilot uses AI. Check for mistakes.
Comment on lines +84 to +92
@skip-mysql
Scenario: Skip on MySQL databases
Given a WP install

When I run `wp eval 'echo "This should only run on MariaDB or SQLite";'`
Then STDOUT should contain:
"""
This should only run on MariaDB or SQLite
"""
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These scenarios are intended to demonstrate/verify @skip-* behavior, but the steps/assertions are database-agnostic (they just echo a static string). If the skip-tag implementation regresses and scenarios run on the “skipped” DB, they will still pass and won’t catch it. Consider making each scenario contain a DB-specific step that would fail on the skipped DB (e.g., combine @require-mysql-or-mariadb with @skip-mysql and assert SELECT VERSION() contains MariaDB, and use @skip-sqlite with a SHOW TABLES assertion).

Copilot uses AI. Check for mistakes.
Comment on lines +94 to +102
@skip-mariadb
Scenario: Skip on MariaDB databases
Given a WP install

When I run `wp eval 'echo "This should only run on MySQL or SQLite";'`
Then STDOUT should contain:
"""
This should only run on MySQL or SQLite
"""
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This scenario’s assertion is a static echo, so it will pass on any database if @skip-mariadb is not applied correctly. To actually validate @skip-mariadb, make the scenario fail on MariaDB (or assert it is running on MySQL) using a DB-specific query/output check.

Copilot uses AI. Check for mistakes.
Comment on lines +104 to +112
@skip-sqlite
Scenario: Skip on SQLite databases
Given a WP install

When I run `wp eval 'echo "This should only run on MySQL or MariaDB";'`
Then STDOUT should contain:
"""
This should only run on MySQL or MariaDB
"""
Copy link

Copilot AI Feb 8, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same issue here: the scenario will succeed regardless of DB type because it only checks a static string. If the goal is to ensure @skip-sqlite works, consider using a query that would fail on SQLite (e.g. SHOW TABLES) so the scenario fails if it accidentally runs under SQLite.

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add skip-<dbtype> tags

2 participants