| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Tests\Maintenance; |
| 4 |
|
| 5 |
use PatchSql; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class PatchSqlTest extends MaintenanceBaseTestCase { |
| 13 |
|
| 14 |
protected function getMaintenanceClass() { |
| 15 |
return PatchSql::class; |
| 16 |
} |
| 17 |
|
| 18 |
public function testExecute() { |
| 19 |
|
| 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 |
|
| 25 |
$this->maintenance->setArg( 'patch-name', $testFilename ); |
| 26 |
$this->maintenance->execute(); |
| 27 |
|
| 28 |
$this->newSelectQueryBuilder() |
| 29 |
->select( [ 'ul_key', 'ul_value' ] ) |
| 30 |
->from( 'updatelog' ) |
| 31 |
->caller( __METHOD__ ) |
| 32 |
->assertRowValue( [ 'testing1234', 'testing' ] ); |
| 33 |
} |
| 34 |
} |