Mercurial > hg > isophonics-drupal-site
annotate vendor/sebastian/comparator/src/MockObjectComparator.php @ 19:fa3358dc1485 tip
Add ndrum files
author | Chris Cannam |
---|---|
date | Wed, 28 Aug 2019 13:14:47 +0100 |
parents | 1fec387a4317 |
children |
rev | line source |
---|---|
Chris@0 | 1 <?php |
Chris@0 | 2 /* |
Chris@14 | 3 * This file is part of sebastian/comparator. |
Chris@0 | 4 * |
Chris@0 | 5 * (c) Sebastian Bergmann <sebastian@phpunit.de> |
Chris@0 | 6 * |
Chris@0 | 7 * For the full copyright and license information, please view the LICENSE |
Chris@0 | 8 * file that was distributed with this source code. |
Chris@0 | 9 */ |
Chris@0 | 10 |
Chris@0 | 11 namespace SebastianBergmann\Comparator; |
Chris@0 | 12 |
Chris@0 | 13 /** |
Chris@0 | 14 * Compares PHPUnit_Framework_MockObject_MockObject instances for equality. |
Chris@0 | 15 */ |
Chris@0 | 16 class MockObjectComparator extends ObjectComparator |
Chris@0 | 17 { |
Chris@0 | 18 /** |
Chris@0 | 19 * Returns whether the comparator can compare two values. |
Chris@0 | 20 * |
Chris@14 | 21 * @param mixed $expected The first value to compare |
Chris@14 | 22 * @param mixed $actual The second value to compare |
Chris@14 | 23 * |
Chris@0 | 24 * @return bool |
Chris@0 | 25 */ |
Chris@0 | 26 public function accepts($expected, $actual) |
Chris@0 | 27 { |
Chris@14 | 28 return ($expected instanceof \PHPUnit_Framework_MockObject_MockObject || $expected instanceof \PHPUnit\Framework\MockObject\MockObject) && |
Chris@14 | 29 ($actual instanceof \PHPUnit_Framework_MockObject_MockObject || $actual instanceof \PHPUnit\Framework\MockObject\MockObject); |
Chris@0 | 30 } |
Chris@0 | 31 |
Chris@0 | 32 /** |
Chris@0 | 33 * Converts an object to an array containing all of its private, protected |
Chris@0 | 34 * and public properties. |
Chris@0 | 35 * |
Chris@14 | 36 * @param object $object |
Chris@14 | 37 * |
Chris@0 | 38 * @return array |
Chris@0 | 39 */ |
Chris@0 | 40 protected function toArray($object) |
Chris@0 | 41 { |
Chris@0 | 42 $array = parent::toArray($object); |
Chris@0 | 43 |
Chris@0 | 44 unset($array['__phpunit_invocationMocker']); |
Chris@0 | 45 |
Chris@0 | 46 return $array; |
Chris@0 | 47 } |
Chris@14 | 48 } |