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 PHPUnit.
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 PHPUnit\Framework\Constraint;
11
 
12
use function is_dir;
13
use function sprintf;
14
 
15
/**
16
 * @no-named-arguments Parameter names are not covered by the backward compatibility promise for PHPUnit
17
 */
18
final class DirectoryExists extends Constraint
19
{
20
    /**
21
     * Returns a string representation of the constraint.
22
     */
23
    public function toString(): string
24
    {
25
        return 'directory exists';
26
    }
27
 
28
    /**
29
     * Evaluates the constraint for parameter $other. Returns true if the
30
     * constraint is met, false otherwise.
31
     *
32
     * @param mixed $other value or object to evaluate
33
     */
34
    protected function matches($other): bool
35
    {
36
        return is_dir($other);
37
    }
38
 
39
    /**
40
     * Returns the description of the failure.
41
     *
42
     * The beginning of failure messages is "Failed asserting that" in most
43
     * cases. This method should return the second part of that sentence.
44
     *
45
     * @param mixed $other evaluated value or object
46
     */
47
    protected function failureDescription($other): string
48
    {
49
        return sprintf(
50
            'directory "%s" exists',
51
            $other
52
        );
53
    }
54
}