forked from Codeception/Codeception
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Filesystem] Created tests for (dont)SeeFileFound
To verify Codeception#3877
- Loading branch information
1 parent
990bfd2
commit c054f56
Showing
1 changed file
with
85 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
<?php | ||
|
||
use Codeception\Module\Filesystem; | ||
use Codeception\Util\Stub; | ||
|
||
class FilesystemTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
/** | ||
* @var \Codeception\Module\Filesystem | ||
*/ | ||
protected $module; | ||
|
||
public function setUp() | ||
{ | ||
$this->module = new Filesystem(make_container()); | ||
$this->module->_before(Stub::makeEmpty('\Codeception\Test\Test')); | ||
} | ||
|
||
|
||
public function tearDown() | ||
{ | ||
$this->module->_after(Stub::makeEmpty('\Codeception\Test\Test')); | ||
} | ||
|
||
public function testSeeFileFoundPassesWhenFileExists() | ||
{ | ||
$this->module->seeFileFound('tests/data/dumps/mysql.sql'); | ||
} | ||
|
||
public function testSeeFileFoundPassesWhenFileExistsInSubdirectoryOfPath() | ||
{ | ||
$this->module->seeFileFound('mysql.sql', 'tests/data/'); | ||
} | ||
|
||
/** | ||
* @expectedException PHPUnit_Framework_AssertionFailedError | ||
* @expectedExceptionMessage File "does-not-exist" not found at | ||
*/ | ||
public function testSeeFileFoundFailsWhenFileDoesNotExist() | ||
{ | ||
$this->module->seeFileFound('does-not-exist'); | ||
} | ||
|
||
/** | ||
* @expectedException PHPUnit_Framework_AssertionFailedError | ||
* @expectedExceptionMessageRegExp /Directory does not exist: .*does-not-exist/ | ||
*/ | ||
public function testSeeFileFoundFailsWhenPathDoesNotExist() | ||
{ | ||
$this->module->seeFileFound('mysql.sql', 'does-not-exist'); | ||
} | ||
|
||
public function testDontSeeFileFoundPassesWhenFileDoesNotExists() | ||
{ | ||
$this->module->dontSeeFileFound('does-not-exist'); | ||
} | ||
|
||
/** | ||
* @expectedException PHPUnit_Framework_AssertionFailedError | ||
* @expectedExceptionMessage Failed asserting that file "tests/data/dumps/mysql.sql" does not exist. | ||
*/ | ||
public function testDontSeeFileFoundFailsWhenFileExists() | ||
{ | ||
$this->module->dontSeeFileFound('tests/data/dumps/mysql.sql'); | ||
} | ||
|
||
/** | ||
* @expectedException PHPUnit_Framework_AssertionFailedError | ||
* @expectedExceptionMessageRegExp /Directory does not exist: .*does-not-exist/ | ||
*/ | ||
public function testDontSeeFileFoundFailsWhenPathDoesNotExist() | ||
{ | ||
$this->module->dontSeeFileFound('mysql.sql', 'does-not-exist'); | ||
} | ||
|
||
/** | ||
* @expectedException PHPUnit_Framework_AssertionFailedError | ||
* @expectedExceptionMessage Failed asserting that file "tests/data/dumps/mysql.sql" does not exist. | ||
*/ | ||
public function testDontSeeFileFoundFailsWhenFileExistsInSubdirectoryOfPath() | ||
{ | ||
$this->module->dontSeeFileFound('mysql.sql', 'tests/data/'); | ||
} | ||
} |