MDL-36031 implement message redirection for unit testing

This commit is contained in:
Petr Škoda
2012-10-13 20:00:54 +02:00
parent 2105f57590
commit 4c9e03f0ac
6 changed files with 330 additions and 0 deletions
+13
View File
@@ -306,6 +306,19 @@ abstract class advanced_testcase extends PHPUnit_Framework_TestCase {
$this->assertEquals(0, $count, $message);
}
/**
* Starts message redirection.
*
* You can verify if messages were sent or not by inspecting the messages
* array in the returned messaging sink instance. The redirection
* can be stopped by calling $sink->close();
*
* @return phpunit_message_sink
*/
public function redirectMessages() {
return phpunit_util::start_message_redirection();
}
/**
* Cleanup after all tests are executed.
*