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 function is_resource;
13
 
14
/**
15
 * Compares resources for equality.
16
 */
17
class ResourceComparator extends Comparator
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 is_resource($expected) && is_resource($actual);
30
    }
31
 
32
    /**
33
     * Asserts that two values are equal.
34
     *
35
     * @param mixed $expected     First value to compare
36
     * @param mixed $actual       Second value to compare
37
     * @param float $delta        Allowed numerical distance between two values to consider them equal
38
     * @param bool  $canonicalize Arrays are sorted before comparison when set to true
39
     * @param bool  $ignoreCase   Case is ignored when set to true
40
     *
41
     * @throws ComparisonFailure
42
     */
43
    public function assertEquals($expected, $actual, $delta = 0.0, $canonicalize = false, $ignoreCase = false)/*: void*/
44
    {
45
        if ($actual != $expected) {
46
            throw new ComparisonFailure(
47
                $expected,
48
                $actual,
49
                $this->exporter->export($expected),
50
                $this->exporter->export($actual)
51
            );
52
        }
53
    }
54
}