当前位置: 首页>>代码示例>>PHP>>正文


PHP PHPUnit_Framework_Assert::assertFileExists方法代码示例

本文整理汇总了PHP中PHPUnit_Framework_Assert::assertFileExists方法的典型用法代码示例。如果您正苦于以下问题:PHP PHPUnit_Framework_Assert::assertFileExists方法的具体用法?PHP PHPUnit_Framework_Assert::assertFileExists怎么用?PHP PHPUnit_Framework_Assert::assertFileExists使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在PHPUnit_Framework_Assert的用法示例。


在下文中一共展示了PHPUnit_Framework_Assert::assertFileExists方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: fileShouldContain

 /**
  * @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);
     });
 }
开发者ID:epfremmer,项目名称:PHP-Weekly-Issue39,代码行数:15,代码来源:FeatureContext.php

示例2: fileShouldContain

 /**
  * Checks whether specified file exists and contains specified string.
  *
  * @Then /^"([^"]*)" file should contain:$/
  *
  * @param string       $path file path
  * @param PyStringNode $text file content
  */
 public function fileShouldContain($path, PyStringNode $text)
 {
     $path = $this->workingDir . '/' . $path;
     PHPUnit_Framework_Assert::assertFileExists($path);
     $fileContent = trim(file_get_contents($path));
     // Normalize the line endings in the output
     if ("\n" !== PHP_EOL) {
         $fileContent = str_replace(PHP_EOL, "\n", $fileContent);
     }
     PHPUnit_Framework_Assert::assertEquals($this->getExpectedOutput($text), $fileContent);
 }
开发者ID:codifico,项目名称:phpspec-rest-view-extension,代码行数:19,代码来源:FeatureContext.php

示例3: toExist

 public function toExist()
 {
     if ($this->negate) {
         a::assertFileNotExists($this->actual);
     } else {
         a::assertFileExists($this->actual);
     }
 }
开发者ID:jasonmccreary,项目名称:expect,代码行数:8,代码来源:Expect.php

示例4: shouldContain

 /**
  * Checks whether specified file exists and contains specified string.
  *
  * @Then /^"([^"]*)" should contain( the string|):$/
  */
 public function shouldContain($path, $subString, PyStringNode $string)
 {
     $subString = !empty($subString);
     if ($path[0] == '~') {
         $path = $this->homeDir . ltrim($path, '~');
     } else {
         $path = $this->workingDir . '/' . $path;
     }
     PHPUnit_Framework_Assert::assertFileExists($path);
     $fileContent = trim(file_get_contents($path));
     // Normalize the line endings in the output
     if ("\n" !== PHP_EOL) {
         $fileContent = str_replace(PHP_EOL, "\n", $fileContent);
     }
     // Trim trailing whitespace. It usually messes things up.
     $fileContent = trim(preg_replace("/ +\$/m", '', $fileContent));
     if ($subString) {
         PHPUnit_Framework_Assert::assertContains((string) $string, $fileContent);
     } else {
         PHPUnit_Framework_Assert::assertEquals((string) $string, $fileContent);
     }
 }
开发者ID:xendk,项目名称:proctor,代码行数:27,代码来源:FeatureContext.php

示例5: exists

 public function exists()
 {
     if (!$this->isFileExpectation) {
         throw new \Exception('exists() expectation should be called with expect_file()');
     }
     a::assertFileExists($this->actual, $this->description);
 }
开发者ID:jaschweder,项目名称:Verify,代码行数:7,代码来源:Verify.php

示例6: theFileShouldExists

 /**
  * @Then The :key file should exists
  */
 public function theFileShouldExists($key)
 {
     \PHPUnit_Framework_Assert::assertFileExists($this->result[$key]);
     unlink($this->result[$key]);
 }
开发者ID:rwentzeis,项目名称:sdk,代码行数:8,代码来源:SdkContext.php

示例7: assertFileContents

 /**
  * @Then :name file should contain:
  */
 public function assertFileContents($name, PyStringNode $contents)
 {
     PHPUnit_Framework_Assert::assertFileExists($name);
     PHPUnit_Framework_Assert::assertContains($contents->getRaw(), file_get_contents($name));
 }
开发者ID:wouterj,项目名称:fred,代码行数:8,代码来源:FeatureContext.php

示例8: assertFileExists

 /**
  * Checks if file exists
  *  
  * @param string $filename
  * @param string $message
  */
 protected function assertFileExists($filename, $message = '')
 {
     \PHPUnit_Framework_Assert::assertFileExists($filename, $message);
 }
开发者ID:hitechdk,项目名称:Codeception,代码行数:10,代码来源:Asserts.php

示例9: theJunitFileShouldContain

 /**
  * @Then /^the junit file "([^"]*)" should contain:$/
  */
 public function theJunitFileShouldContain($file, PyStringNode $text)
 {
     PHPUnit_Framework_Assert::assertFileExists($file);
     // replace random time ...
     $contents = preg_replace('@time="[0-9.]*"@', 'time="XXX"', file_get_contents($file));
     // replace random path
     $contents = preg_replace('@[0-9a-zA-Z]{32}@', 'XXX', $contents);
     // fix random path in exception ...
     $contents = preg_replace('@<!\\[CDATA\\[.*\\]\\]>@s', '<![CDATA[XXX]]>', $contents);
     PHPUnit_Framework_Assert::assertEquals($contents, (string) $text);
 }
开发者ID:michaelyin1,项目名称:Modern-Toolkit,代码行数:14,代码来源:FeatureContext.php

示例10: assertVfsFileExists

 /**
  * Asserts that a vfs file exists.
  *
  * @param $filename
  * @param string $message
  */
 public function assertVfsFileExists($filename, $message = '')
 {
     PHPUnit::assertFileExists($this->getPath($filename), $message);
 }
开发者ID:newup,项目名称:core,代码行数:10,代码来源:AssertionsTrait.php

示例11: theFileShouldExistInProject

 /**
  * @Then the file :file should exist in :project
  */
 public function theFileShouldExistInProject($file, $project)
 {
     $path = sprintf('%s/%s/%s', $this->cwd, $project, $file);
     Assert::assertFileExists($path);
 }
开发者ID:yuloh,项目名称:ketch,代码行数:8,代码来源:FeatureContext.php

示例12: seeFileFound

 /**
  * Checks if file exists in path.
  * Opens a file when it's exists
  *
  * ``` php
  * <?php
  * $I->seeFileFound('UserModel.php','app/models');
  * ?>
  * ```
  *
  * @param $filename
  * @param string $path
  */
 public function seeFileFound($filename, $path = '')
 {
     if (file_exists($filename) and !$path) {
         $this->openFile($filename);
         $this->filepath = $filename;
         $this->debug($filename);
         \PHPUnit_Framework_Assert::assertFileExists($path . $filename);
         return;
     }
     $path = $this->absolutizePath($path);
     $this->debug($path);
     if (!file_exists($path)) {
         \PHPUnit_Framework_Assert::fail("Directory does not exist: {$path}");
     }
     $files = Finder::create()->files()->name($filename)->in($path);
     foreach ($files as $file) {
         $file = $file->getRealPath();
         $this->openFile($file);
         $this->filepath = $file;
         $this->debug($file);
         \PHPUnit_Framework_Assert::assertFileExists($file);
         return;
     }
     \Codeception\Util\Debug::pause();
     $this->fail("{$filename} in {$path}");
 }
开发者ID:itillawarra,项目名称:cmfive,代码行数:39,代码来源:Filesystem.php

示例13: fileXmlShouldBeLike

 /**
  * Checks whether specified content and structure of the xml is correct without worrying about layout.
  *
  * @Then /^"([^"]*)" file xml should be like:$/
  *
  * @param string       $path file path
  * @param PyStringNode $text file content
  */
 public function fileXmlShouldBeLike($path, PyStringNode $text)
 {
     $path = $this->workingDir . '/' . $path;
     PHPUnit_Framework_Assert::assertFileExists($path);
     $fileContent = trim(file_get_contents($path));
     $dom = new DOMDocument();
     $dom->loadXML($text);
     $dom->formatOutput = true;
     PHPUnit_Framework_Assert::assertEquals(trim($dom->saveXML(null, LIBXML_NOEMPTYTAG)), $fileContent);
 }
开发者ID:pierrerolland,项目名称:openl10n-cli,代码行数:18,代码来源:FeatureContext.php

示例14: shouldExist

 public function shouldExist()
 {
     Assert::assertFileExists($this->it);
 }
开发者ID:pago,项目名称:pantr,代码行数:4,代码来源:FileMatcher.php

示例15: toExist

 /**
  * Expect that a file exists.
  *
  * @param string $message
  *
  * @return Expect
  */
 public function toExist($message = '')
 {
     Assert::assertFileExists($this->value, $message);
     return $this;
 }
开发者ID:jpkleemans,项目名称:phpunit-expect,代码行数:12,代码来源:Expect.php


注:本文中的PHPUnit_Framework_Assert::assertFileExists方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。