Skip to content

Commit 197c05e

Browse files
authored
Harden unit tests (#275)
1 parent 29f6e93 commit 197c05e

File tree

1 file changed

+21
-1
lines changed

1 file changed

+21
-1
lines changed

tests/tests/TestBehatTags.php

Lines changed: 21 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -143,10 +143,30 @@ public function test_behat_tags_php_version(): void {
143143
$this->markTestSkipped( "No test for PHP_VERSION $php_version." );
144144
}
145145

146+
$expected .= '&&~@github-api&&~@broken';
147+
148+
$db_type = getenv( 'WP_CLI_TEST_DBTYPE' );
149+
switch ( $db_type ) {
150+
case 'mariadb':
151+
$expected .= '&&~@require-mysql';
152+
$expected .= '&&~@require-sqlite';
153+
break;
154+
case 'sqlite':
155+
$expected .= '&&~@require-mariadb';
156+
$expected .= '&&~@require-mysql';
157+
$expected .= '&&~@require-mysql-or-mariadb';
158+
break;
159+
case 'mysql':
160+
default:
161+
$expected .= '&&~@require-mariadb';
162+
$expected .= '&&~@require-sqlite';
163+
break;
164+
}
165+
146166
file_put_contents( $this->temp_dir . '/features/php_version.feature', $contents );
147167

148168
$output = exec( "cd {$this->temp_dir}; php $behat_tags" );
149-
$this->assertSame( '--tags=' . $expected . '&&~@github-api&&~@broken&&~@require-mariadb&&~@require-sqlite', $output );
169+
$this->assertSame( '--tags=' . $expected, $output );
150170

151171
putenv( false === $env_github_token ? 'GITHUB_TOKEN' : "GITHUB_TOKEN=$env_github_token" );
152172
}

0 commit comments

Comments
 (0)