MediaWiki  master
MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase Class Reference
Inheritance diagram for MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase:
Collaboration diagram for MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase:

Protected Member Functions

 assertOutputPrePostShutdown ( $preShutdownOutput, $expectNLAppending)
 Asserts the output before and after simulating shutdown. More...
 
 createMaintenance ()
 Called by setUp to initialize $this->maintenance. More...
 
 getMaintenanceClass ()
 
 setUp ()
 
 tearDown ()
 Do a little stream cleanup to prevent output in case the child class hasn't tested the capture buffer. More...
 

Protected Attributes

Maintenance $maintenance
 The main Maintenance instance that is used for testing, wrapped and mockable. More...
 

Detailed Description

Definition at line 9 of file MaintenanceBaseTestCase.php.

Member Function Documentation

◆ assertOutputPrePostShutdown()

MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase::assertOutputPrePostShutdown (   $preShutdownOutput,
  $expectNLAppending 
)
protected

Asserts the output before and after simulating shutdown.

This function simulates shutdown of self::maintenance.

Parameters
string$preShutdownOutputExpected output before simulating shutdown
bool$expectNLAppendingWhether or not shutdown simulation is expected to add a newline to the output. If false, $preShutdownOutput is the expected output after shutdown simulation. Otherwise, $preShutdownOutput with an appended newline is the expected output after shutdown simulation.

Definition at line 83 of file MaintenanceBaseTestCase.php.

Referenced by MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledAfterNLOutput(), MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledAfterNLOutputWChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledAfterNLOutputWNullChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledAfterOutput(), MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledAfterOutputChanneledWChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledAfterOutputChanneledWNullChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledAfterOutputChanneledWOChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledAfterOutputWChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledAfterOutputWNullChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testCleanupChanneledClean(), MediaWiki\Tests\Maintenance\MaintenanceTest\testMultipleMaintenanceObjectsInteractionCleanupChanneledWChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testMultipleMaintenanceObjectsInteractionOutput(), MediaWiki\Tests\Maintenance\MaintenanceTest\testMultipleMaintenanceObjectsInteractionOutputChanneled(), MediaWiki\Tests\Maintenance\MaintenanceTest\testMultipleMaintenanceObjectsInteractionOutputChanneledWChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testMultipleMaintenanceObjectsInteractionOutputChanneledWNullChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testMultipleMaintenanceObjectsInteractionOutputWChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testMultipleMaintenanceObjectsInteractionOutputWChannelNL(), MediaWiki\Tests\Maintenance\MaintenanceTest\testMultipleMaintenanceObjectsInteractionOutputWNullChannel(), MediaWiki\Tests\Maintenance\MaintenanceTest\testMultipleMaintenanceObjectsInteractionOutputWNullChannelNL(), MediaWiki\Tests\Maintenance\MaintenanceTest\testOutput(), and MediaWiki\Tests\Maintenance\MaintenanceTest\testOutputChanneled().

◆ createMaintenance()

MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase::createMaintenance ( )
protected

Called by setUp to initialize $this->maintenance.

Returns
object The Maintenance instance to test.

Definition at line 62 of file MaintenanceBaseTestCase.php.

References MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase\getMaintenanceClass().

Referenced by MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase\setUp().

◆ getMaintenanceClass()

MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase::getMaintenanceClass ( )
abstractprotected
Returns
string Class name

Subclasses must implement this in order to use the $this->maintenance variable. Normally, it will be set like: return PopulateDatabaseMaintenance::class;

If you need to change the way your maintenance class is constructed, override createMaintenance.

Referenced by MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase\createMaintenance(), and MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase\tearDown().

◆ setUp()

MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase::setUp ( )
protected

◆ tearDown()

MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase::tearDown ( )
protected

Do a little stream cleanup to prevent output in case the child class hasn't tested the capture buffer.

Definition at line 28 of file MaintenanceBaseTestCase.php.

References MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase\getMaintenanceClass().

Member Data Documentation

◆ $maintenance

Maintenance MediaWiki\Tests\Maintenance\MaintenanceBaseTestCase::$maintenance
protected

The main Maintenance instance that is used for testing, wrapped and mockable.

Definition at line 16 of file MaintenanceBaseTestCase.php.


The documentation for this class was generated from the following file: