PHPUnit_Framework_Assert::assertFileExists PHP Method

assertFileExists() public static method

Asserts that a file exists.
public static assertFileExists ( string $filename, string $message = '' )
$filename string
$message string
    public static function assertFileExists($filename, $message = '')
    {
        if (!is_string($filename)) {
            throw PHPUnit_Util_InvalidArgumentHelper::factory(1, 'string');
        }
        $constraint = new PHPUnit_Framework_Constraint_FileExists();
        static::assertThat($filename, $constraint, $message);
    }

Usage Example

 /**
  * @Then :file file should contain:
  *
  * @param string $file
  * @param PyStringNode $strings
  */
 public function fileShouldContain($file, PyStringNode $strings)
 {
     PHPUnit::assertFileExists($file);
     $contents = file_get_contents($file);
     $strings = $strings->getStrings();
     array_walk($strings, function ($string) use($contents) {
         PHPUnit::assertContains($string, $contents);
     });
 }
All Usage Examples Of PHPUnit_Framework_Assert::assertFileExists
PHPUnit_Framework_Assert