Localisation updates from https://translatewiki.net.
[mediawiki.git] / tests / phpunit / maintenance / PurgeOldTextTest.php
blob4a306e6269d6f5ebbf0f0a30ff665484ab922b4d
1 <?php
3 namespace MediaWiki\Tests\Maintenance;
5 use MediaWiki\Maintenance\Maintenance;
6 use PHPUnit\Framework\MockObject\MockObject;
7 use PurgeOldText;
8 use Wikimedia\TestingAccessWrapper;
10 /**
11 * @covers \PurgeOldText
12 * @author Dreamy Jazz
14 class PurgeOldTextTest extends MaintenanceBaseTestCase {
16 /** @var Maintenance|MockObject */
17 protected $maintenance;
19 public function getMaintenanceClass() {
20 return PurgeOldText::class;
23 protected function createMaintenance() {
24 // Mock ::purgeRedundantText as this should be separately tested
25 $obj = $this->getMockBuilder( $this->getMaintenanceClass() )
26 ->onlyMethods( [ 'purgeRedundantText' ] )
27 ->getMock();
28 return TestingAccessWrapper::newFromObject( $obj );
31 /** @dataProvider providePurgeOptionValues */
32 public function testExecute( $purgeOptionProvided ) {
33 $this->maintenance->expects( $this->once() )
34 ->method( 'purgeRedundantText' )
35 ->with( $purgeOptionProvided );
36 if ( $purgeOptionProvided ) {
37 $this->maintenance->setOption( 'purge', 1 );
39 $this->maintenance->execute();
42 public static function providePurgeOptionValues() {
43 return [
44 '--purge not provided' => [ false ],
45 '--purge provided' => [ true ],