Subversion-Projekte lars-tiefland.laravel_shop

Revision

Details | Letzte Änderung | Log anzeigen | RSS feed

Revision Autor Zeilennr. Zeile
148 lars 1
<?php declare(strict_types=1);
2
/*
3
 * This file is part of sebastian/comparator.
4
 *
5
 * (c) Sebastian Bergmann <sebastian@phpunit.de>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 */
10
namespace SebastianBergmann\Comparator;
11
 
12
use PHPUnit\Framework\MockObject\MockObject;
13
 
14
/**
15
 * Compares PHPUnit\Framework\MockObject\MockObject instances for equality.
16
 */
17
class MockObjectComparator extends ObjectComparator
18
{
19
    /**
20
     * Returns whether the comparator can compare two values.
21
     *
22
     * @param mixed $expected The first value to compare
23
     * @param mixed $actual   The second value to compare
24
     *
25
     * @return bool
26
     */
27
    public function accepts($expected, $actual)
28
    {
29
        return $expected instanceof MockObject && $actual instanceof MockObject;
30
    }
31
 
32
    /**
33
     * Converts an object to an array containing all of its private, protected
34
     * and public properties.
35
     *
36
     * @param object $object
37
     *
38
     * @return array
39
     */
40
    protected function toArray($object)
41
    {
42
        $array = parent::toArray($object);
43
 
44
        unset($array['__phpunit_invocationMocker']);
45
 
46
        return $array;
47
    }
48
}