Ejemplo n.º 1
0
 public function doAssert(\Hamcrest_Matcher $matcher, $message = null)
 {
     if (!empty($message)) {
         \Hamcrest_MatcherAssert::assertThat($message, $this->value, $matcher);
     } else {
         \Hamcrest_MatcherAssert::assertThat($this->value, $matcher);
     }
 }
Ejemplo n.º 2
0
 public function doAssert(\Hamcrest_Matcher $matcher, $message = null)
 {
     if (!empty($message)) {
         \Hamcrest_MatcherAssert::assertThat($message, $this->value, \Hamcrest_Core_IsCollectionContaining::hasItem($matcher));
     } else {
         \Hamcrest_MatcherAssert::assertThat($this->value, \Hamcrest_Core_IsCollectionContaining::hasItem($matcher));
     }
 }
Ejemplo n.º 3
0
 /**
  * Resets the number of assertions performed to zero.
  */
 public static function resetCount()
 {
     self::$_count = 0;
 }
Ejemplo n.º 4
0
 /**
  * The standard tearDown method invocation
  *
  * @param Spec\TestCaseInterface $test
  */
 public function tearDown(Spec\TestCaseInterface $test)
 {
     if (class_exists('\\Hamcrest_MatcherAssert', true)) {
         $test->addToAssertionCount(\Hamcrest_MatcherAssert::getCount() - $test->hamcrestAssertCount);
     }
     $suite = $test->getSuite();
     // Restore the world
     $suite->restoreWorldSnapshot();
     // @todo Move callback invocation logic here
     $suite->runAfterEachCallbacks($test);
 }
Ejemplo n.º 5
0
 public function testAssertThatWithFourArgsThrowsErrorAndDoesntIncrementCount()
 {
     try {
         Hamcrest_MatcherAssert::assertThat(1, 2, 3, 4);
         self::fail('expected invalid argument exception');
     } catch (InvalidArgumentException $ex) {
         self::assertEquals(0, Hamcrest_MatcherAssert::getCount(), 'assertion count');
     }
 }