Chris@0: Chris@0: * Chris@0: * For the full copyright and license information, please view the LICENSE Chris@0: * file that was distributed with this source code. Chris@0: */ Chris@0: Chris@0: namespace SebastianBergmann\Comparator; Chris@0: Chris@0: /** Chris@0: * Compares PHPUnit_Framework_MockObject_MockObject instances for equality. Chris@0: */ Chris@0: class MockObjectComparator extends ObjectComparator Chris@0: { Chris@0: /** Chris@0: * Returns whether the comparator can compare two values. Chris@0: * Chris@14: * @param mixed $expected The first value to compare Chris@14: * @param mixed $actual The second value to compare Chris@14: * Chris@0: * @return bool Chris@0: */ Chris@0: public function accepts($expected, $actual) Chris@0: { Chris@14: return ($expected instanceof \PHPUnit_Framework_MockObject_MockObject || $expected instanceof \PHPUnit\Framework\MockObject\MockObject) && Chris@14: ($actual instanceof \PHPUnit_Framework_MockObject_MockObject || $actual instanceof \PHPUnit\Framework\MockObject\MockObject); Chris@0: } Chris@0: Chris@0: /** Chris@0: * Converts an object to an array containing all of its private, protected Chris@0: * and public properties. Chris@0: * Chris@14: * @param object $object Chris@14: * Chris@0: * @return array Chris@0: */ Chris@0: protected function toArray($object) Chris@0: { Chris@0: $array = parent::toArray($object); Chris@0: Chris@0: unset($array['__phpunit_invocationMocker']); Chris@0: Chris@0: return $array; Chris@0: } Chris@14: }