1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?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');
}
public function testDontSeeFileFoundPassesWhenFileDoesNotExistsInPath()
{
$this->module->dontSeeFileFound('does-not-exist', 'tests/data/');
}
/**
* @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
* @expectedExceptionMessageRegExp /Failed asserting that file ".*tests\/data\/dumps\/mysql.sql" does not exist/
*/
public function testDontSeeFileFoundFailsWhenFileExistsInSubdirectoryOfPath()
{
$this->module->dontSeeFileFound('mysql.sql', 'tests/data/');
}
}