expectError() public method

If this is not fulfilled at the end of the test, a failure will occour. If the error does happen, then this will cancel it out and send a pass message.
public expectError ( SimpleExpectation $expected, string $message )
$expected SimpleExpectation Expected error match.
$message string Message to display.
コード例 #1
0
ファイル: errors_test.php プロジェクト: Clansuite/Clansuite
 public function testExpectationMatchCancelsIncomingError()
 {
     $test = new MockSimpleTestCase();
     $test->expectOnce('assert', array(new IdenticalExpectation(new AnythingExpectation()), 'B', 'a message'));
     $test->setReturnValue('assert', true);
     $test->expectNever('error');
     $queue = new SimpleErrorQueue();
     $queue->setTestCase($test);
     $queue->expectError(new AnythingExpectation(), 'a message');
     $queue->add(1024, 'B', 'b.php', 100);
 }
コード例 #2
0
 function testExpectationMissTriggersError()
 {
     $test = new MockSimpleTestCase();
     $test->expectOnce('assert', array(new MockSimpleExpectation(), 'B', 'a message'));
     $test->setReturnValue('assert', false);
     $test->expectOnce('error');
     $queue = new SimpleErrorQueue();
     $queue->setTestCase($test);
     $queue->expectError(new MockSimpleExpectation(), 'a message');
     $queue->add(1024, 'B', 'b.php', 100);
 }