/** * @param mixed $other * @param string $description * @param boolean $not */ protected function failureDescription($other) { $containerDiff = Util::compareContainers($this->_expectedContainer, $other, $this->_strict); $message = 'Tokens are different:' . PHP_EOL . PHP_EOL . $containerDiff; return $message; }
/** * @covers \Tests\Constraint\TokenContainerMatch::failureDescription */ public function testFailAndFailureDescription() { $expected = new TokenContainer('<?php echo "foo"; ?>'); $other = new TokenContainer('<?php echo "foo"; /* foo */ ?>'); $containerMatch = new TokenContainerMatch($expected, false); $containerDiff = Util::compareContainers($expected, $other, false); $message = 'Failed asserting that Tokens are different:' . PHP_EOL . PHP_EOL . $containerDiff . '.'; try { $containerMatch->evaluate($other); $this->fail('no exception thrown'); } catch (\PHPUnit_Framework_ExpectationFailedException $e) { $this->assertEquals($message, $e->getMessage()); } }
/** * @covers \Tests\Util::compareContainers * @dataProvider containerCompareProvider */ public function testCompareContainer($expectedContainer, $actualContainer, $expectedDump, $strict) { $dump = Util::compareContainers($expectedContainer, $actualContainer, $strict); $this->assertSame($expectedDump, $dump, 'Dump does not match'); }