| 1 |
<?php |
| 2 |
|
| 3 |
namespace MediaWiki\Tests\Maintenance; |
| 4 |
|
| 5 |
use DumpRev; |
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
class DumpRevTest extends MaintenanceBaseTestCase { |
| 13 |
|
| 14 |
protected function getMaintenanceClass() { |
| 15 |
return DumpRev::class; |
| 16 |
} |
| 17 |
|
| 18 |
public function testExecuteForMissingRevisionId() { |
| 19 |
$this->maintenance->setArg( 'rev-id', 123 ); |
| 20 |
$this->expectCallToFatalError(); |
| 21 |
$this->expectOutputRegex( '/Row not found/' ); |
| 22 |
$this->maintenance->execute(); |
| 23 |
} |
| 24 |
|
| 25 |
public function testExecute() { |
| 26 |
$revId = $this->editPage( $this->getNonexistingTestPage(), 'testing1234' )->getNewRevision()->getId(); |
| 27 |
$this->maintenance->setArg( 'rev-id', $revId ); |
| 28 |
$this->maintenance->execute(); |
| 29 |
$this->expectOutputString( "Text length: 11\ntesting1234\n" ); |
| 30 |
} |
| 31 |
} |