MediaWiki  REL1_22
MaintenanceFixup Class Reference

makes parts of the API of Maintenance that is hidden by protected visibily visible for testing, and makes up for a stream closing hack in Maintenance.php. More...

Inheritance diagram for MaintenanceFixup:
Collaboration diagram for MaintenanceFixup:

List of all members.

Public Member Functions

 __construct (MediaWikiTestCase $testCase)
 __destruct ()
 Safety net around register_shutdown_function of Maintenance.php.
 execute ()
 output ($out, $channel=null)
 Throw some output to the user.
 outputChanneled ($msg, $channel=null)
 Message outputter with channeled message support.
 simulateShutdown ()
 Simulates what Maintenance wants to happen at script's end.

Private Attributes

bool $shutdownSimulated = false
 shutdownSimulated === true if simulateShutdown has done it's work
MediaWikiTestCase $testCase
 The test case that generated this instance.

Detailed Description

makes parts of the API of Maintenance that is hidden by protected visibily visible for testing, and makes up for a stream closing hack in Maintenance.php.

This class is solely used for being able to test Maintenance right now without having to apply major refactorings to fix some design issues in Maintenance.php. Before adding more functions here, please consider whether this approach is correct, or a refactoring Maintenance to separate concers is more appropriate.

Upon refactoring, keep in mind that besides the maintenance scrits themselves and tests right here, also at least Extension:Maintenance make use of Maintenance.

Due to a hack in Maintenance.php using register_shutdown_function, be sure to finally call simulateShutdown on MaintenanceFixup instance before a test ends.

Definition at line 29 of file MaintenanceTest.php.


Constructor & Destructor Documentation

Safety net around register_shutdown_function of Maintenance.php.

Definition at line 88 of file MaintenanceTest.php.

Definition at line 107 of file MaintenanceTest.php.


Member Function Documentation

Reimplemented from Maintenance.

Definition at line 126 of file MaintenanceTest.php.

MaintenanceFixup::output ( out,
channel = null 
)

Throw some output to the user.

Scripts can call this with no fears, as we handle all --quiet stuff here

Parameters:
$outString: the text to show to the user
$channelMixed: unique identifier for the channel. See function outputChanneled.

Reimplemented from Maintenance.

Definition at line 115 of file MaintenanceTest.php.

References array().

MaintenanceFixup::outputChanneled ( msg,
channel = null 
)

Message outputter with channeled message support.

Messages on the same channel are concatenated, but any intervening messages in another channel start a new line.

Parameters:
$msgString: the message without trailing newline
$channelstring Channel identifier or null for no channel. Channel comparison uses ===.

Reimplemented from Maintenance.

Definition at line 67 of file MaintenanceTest.php.

References array().

Simulates what Maintenance wants to happen at script's end.

Definition at line 53 of file MaintenanceTest.php.


Member Data Documentation

bool MaintenanceFixup::$shutdownSimulated = false [private]

shutdownSimulated === true if simulateShutdown has done it's work

Definition at line 48 of file MaintenanceTest.php.

MediaWikiTestCase MaintenanceFixup::$testCase [private]

The test case that generated this instance.

This member is motivated by allowing the destructor to check whether or not the test failed, in order to avoid unnecessary nags about omitted shutdown simulation. But as it is already available, we also usi it to flagging tests as failed

Definition at line 42 of file MaintenanceTest.php.


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