public function testAssertCountTraversable() { $constraint = new testedClass(2); $constraint->evaluate(new \arrayIterator(array(1, 2))); try { $constraint->evaluate(new \arrayIterator(array(1, 2, 3))); $this->fail(); } catch (\PHPUnit_Framework_ExpectationFailedException $exception) { $analyzer = new atoum\tools\variable\analyzer(); $diff = new atoum\tools\diff($analyzer->dump(2), $analyzer->dump(3)); $this->assertEquals('integer(3) is not equal to integer(2)' . PHP_EOL . $diff, $exception->getMessage()); } }
public function testFails() { $constraint = new testedClass(true); try { $constraint->evaluate(false); } catch (\PHPUnit_Framework_ExpectationFailedException $exception) { $analyzer = new atoum\tools\variable\analyzer(); $diff = new atoum\tools\diff($analyzer->dump(true), $analyzer->dump(false)); $this->assertEquals($analyzer->getTypeOf(false) . ' is not true' . PHP_EOL . $diff, $exception->getMessage()); } $constraint = new testedClass(false); try { $constraint->evaluate(true); } catch (\PHPUnit_Framework_ExpectationFailedException $exception) { $analyzer = new atoum\tools\variable\analyzer(); $diff = new atoum\tools\diff($analyzer->dump(false), $analyzer->dump(true)); $this->assertEquals($analyzer->getTypeOf(true) . ' is not false' . PHP_EOL . $diff, $exception->getMessage()); } }