Debian Codegraph @

tests/phpunit/maintenance/PatchSqlTest.php

raw symbols SCIP
1 <?php
2
3 namespace MediaWiki\Tests\Maintenance;
4
5 use PatchSql;
6
7 /**
8 * @covers \PatchSql
9 * @group Database
10 * @author Dreamy Jazz
11 */
12 class PatchSqlTest extends MaintenanceBaseTestCase {
13
14 protected function getMaintenanceClass() {
15 return PatchSql::class;
16 }
17
18 public function testExecute() {
19 // Create a SQL file with an insert query
20 $testFilename = $this->getNewTempFile();
21 $testFile = fopen( $testFilename, 'w' );
22 fwrite( $testFile, "INSERT INTO /*_*/updatelog (ul_key, ul_value) VALUES ('testing1234', 'testing');\n" );
23 fclose( $testFile );
24 // Pass the file to the maintenance script and run it
25 $this->maintenance->setArg( 'patch-name', $testFilename );
26 $this->maintenance->execute();
27 // Check that the insert query worked
28 $this->newSelectQueryBuilder()
29 ->select( [ 'ul_key', 'ul_value' ] )
30 ->from( 'updatelog' )
31 ->caller( __METHOD__ )
32 ->assertRowValue( [ 'testing1234', 'testing' ] );
33 }
34 }