@package SimpleTest
Inheritance: extends SimpleExpectation
 function testEqualComparisonOfMocksDoesNotCrash()
 {
     $expectation = new EqualExpectation(new MockDummy());
     $this->assertTrue($expectation->test(new MockDummy(), true));
 }
 /**
  *    Tests the expectation. True if it differs from the
  *    held value.
  *    @param mixed $compare        Comparison value.
  *    @return boolean              True if correct.
  *    @access public
  */
 function test($compare)
 {
     return !parent::test($compare);
 }
 function test($compare)
 {
     return parent::test(str_replace('\\', '/', $compare));
 }
 /**
  *    Sets the value to compare against.
  *    @param mixed $value       Test value to match.
  *    @param string $message    Customised message on failure.
  *    @access public
  */
 function __construct($value, $message = '%s')
 {
     parent::__construct($value, $message);
 }
Exemple #5
0
 function testHashWithOutOfOrderKeysShouldStillMatch()
 {
     $any_order = new EqualExpectation(array('a' => 1, 'b' => 2));
     $this->assertTrue($any_order->test(array('b' => 2, 'a' => 1)));
 }
 public function test($compare)
 {
     return parent::test(str_replace("\\", '/', $compare));
 }
 function testMessage($compare)
 {
     $message = '';
     foreach ($this->expected as $key => $value) {
         if (isset($compare[$key])) {
             $e = new EqualExpectation($value);
             if ($e->test($compare[$key])) {
                 $message .= $key . ' ok.';
             } else {
                 $message .= $key . ' => ' . $e->overlayMessage($compare[$key], $this->_dumper);
             }
         } else {
             return $key . ' not found';
         }
     }
     return $message;
 }