Commit 979e8d16 by Alexander Makarov

Replaced assertTrue(file_exists with assertFileExists in FileHelperTest

parent 1a7a15a3
...@@ -126,10 +126,10 @@ class FileHelperTest extends TestCase ...@@ -126,10 +126,10 @@ class FileHelperTest extends TestCase
FileHelper::copyDirectory($srcDirName, $dstDirName); FileHelper::copyDirectory($srcDirName, $dstDirName);
$this->assertTrue(file_exists($dstDirName), 'Destination directory does not exist!'); $this->assertFileExists($dstDirName, 'Destination directory does not exist!');
foreach ($files as $name => $content) { foreach ($files as $name => $content) {
$fileName = $dstDirName . DIRECTORY_SEPARATOR . $name; $fileName = $dstDirName . DIRECTORY_SEPARATOR . $name;
$this->assertTrue(file_exists($fileName), 'Directory file is missing!'); $this->assertFileExists($fileName);
$this->assertEquals($content, file_get_contents($fileName), 'Incorrect file content!'); $this->assertEquals($content, file_get_contents($fileName), 'Incorrect file content!');
} }
} }
...@@ -189,7 +189,7 @@ class FileHelperTest extends TestCase ...@@ -189,7 +189,7 @@ class FileHelperTest extends TestCase
FileHelper::removeDirectory($dirName); FileHelper::removeDirectory($dirName);
$this->assertFalse(file_exists($dirName), 'Unable to remove directory!'); $this->assertFileNotExists($dirName, 'Unable to remove directory!');
// should be silent about non-existing directories // should be silent about non-existing directories
FileHelper::removeDirectory($basePath . DIRECTORY_SEPARATOR . 'nonExisting'); FileHelper::removeDirectory($basePath . DIRECTORY_SEPARATOR . 'nonExisting');
...@@ -277,7 +277,7 @@ class FileHelperTest extends TestCase ...@@ -277,7 +277,7 @@ class FileHelperTest extends TestCase
$basePath = $this->testFilePath; $basePath = $this->testFilePath;
$dirName = $basePath . DIRECTORY_SEPARATOR . 'test_dir_level_1' . DIRECTORY_SEPARATOR . 'test_dir_level_2'; $dirName = $basePath . DIRECTORY_SEPARATOR . 'test_dir_level_1' . DIRECTORY_SEPARATOR . 'test_dir_level_2';
$this->assertTrue(FileHelper::createDirectory($dirName), 'FileHelper::createDirectory should return true if directory was created!'); $this->assertTrue(FileHelper::createDirectory($dirName), 'FileHelper::createDirectory should return true if directory was created!');
$this->assertTrue(file_exists($dirName), 'Unable to create directory recursively!'); $this->assertFileExists($dirName, 'Unable to create directory recursively!');
$this->assertTrue(FileHelper::createDirectory($dirName), 'FileHelper::createDirectory should return true for already existing directories!'); $this->assertTrue(FileHelper::createDirectory($dirName), 'FileHelper::createDirectory should return true for already existing directories!');
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment