getMockBuilder( $this->getMaintenanceClass() ) ->onlyMethods( [ 'purgeRedundantText' ] ) ->getMock(); return TestingAccessWrapper::newFromObject( $obj ); } /** @dataProvider providePurgeOptionValues */ public function testExecute( $purgeOptionProvided ) { $this->maintenance->expects( $this->once() ) ->method( 'purgeRedundantText' ) ->with( $purgeOptionProvided ); if ( $purgeOptionProvided ) { $this->maintenance->setOption( 'purge', 1 ); } $this->maintenance->execute(); } public static function providePurgeOptionValues() { return [ '--purge not provided' => [ false ], '--purge provided' => [ true ], ]; } }