Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / maintenance / PatchSqlTest.php
blob42db88bbe7befb78fff0154040f4f386f1446ee7
1 <?php
3 namespace MediaWiki\Tests\Maintenance;
5 use PatchSql;
7 /**
8 * @covers \PatchSql
9 * @group Database
10 * @author Dreamy Jazz
12 class PatchSqlTest extends MaintenanceBaseTestCase {
14 protected function getMaintenanceClass() {
15 return PatchSql::class;
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' ] );