Fix bug in style changes for the Use cases on the live site.
[yaffs-website] / vendor / phpunit / phpunit / src / Framework / Constraint / FileExists.php
1 <?php
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
11 /**
12  * Constraint that checks if the file(name) that it is evaluated for exists.
13  *
14  * The file path to check is passed as $other in evaluate().
15  *
16  * @since Class available since Release 3.0.0
17  */
18 class PHPUnit_Framework_Constraint_FileExists extends PHPUnit_Framework_Constraint
19 {
20     /**
21      * Evaluates the constraint for parameter $other. Returns true if the
22      * constraint is met, false otherwise.
23      *
24      * @param mixed $other Value or object to evaluate.
25      *
26      * @return bool
27      */
28     protected function matches($other)
29     {
30         return file_exists($other);
31     }
32
33     /**
34      * Returns the description of the failure
35      *
36      * The beginning of failure messages is "Failed asserting that" in most
37      * cases. This method should return the second part of that sentence.
38      *
39      * @param mixed $other Evaluated value or object.
40      *
41      * @return string
42      */
43     protected function failureDescription($other)
44     {
45         return sprintf(
46             'file "%s" exists',
47             $other
48         );
49     }
50
51     /**
52      * Returns a string representation of the constraint.
53      *
54      * @return string
55      */
56     public function toString()
57     {
58         return 'file exists';
59     }
60 }