Skip to content

Commit

Permalink
Run the whole MySQL server test suite in lexer tests
Browse files Browse the repository at this point in the history
  • Loading branch information
JanJakes committed Nov 5, 2024
1 parent c4dcb95 commit cc7f392
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/mysql/WP_MySQL_Lexer_Tests.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,28 @@
use PHPUnit\Framework\TestCase;

class WP_MySQL_Lexer_Tests extends TestCase {
/**
* Tokenize the whole MySQL server test suite and make sure
* it produces some tokens and doesn't throw any exceptions.
*/
public function test_tokenize_mysql_test_suite() {
$path = __DIR__ . '/data/queries.csv';
$handle = @fopen( $path, 'r' );
if ( false === $handle ) {
$this->fail( "Failed to open file '$path'." );
}

try {
while ( ( $record = fgetcsv( $handle ) ) !== false ) {
$query = $record[0];
$tokens = WP_MySQL_Lexer::tokenize( $query );
$this->assertNotEmpty( $tokens );
}
} finally {
fclose( $handle );
}
}

/**
* Numbers vs. identifiers:
*
Expand Down

0 comments on commit cc7f392

Please sign in to comment.