1 | <?php |
||
20 | class FileTest extends \PHPUnit_Framework_TestCase |
||
21 | { |
||
22 | use FileProvider; |
||
23 | |||
24 | /** |
||
25 | * 正常系 |
||
26 | * ファイル名を取得できること |
||
27 | * @test |
||
28 | * @dataProvider fileProvider |
||
29 | */ |
||
30 | public function okFileName($file) |
||
34 | |||
35 | /** |
||
36 | * 正常系 |
||
37 | * ファイル拡張子を取得できること |
||
38 | * @test |
||
39 | * @dataProvider fileProvider |
||
40 | */ |
||
41 | public function okFileExtension($file) |
||
45 | |||
46 | /** |
||
47 | * 正常系 |
||
48 | * ファイルパスを取得できること |
||
49 | * @test |
||
50 | * @dataProvider fileProvider |
||
51 | */ |
||
52 | public function okFilePath($file) |
||
56 | |||
57 | /** |
||
58 | * 正常系 |
||
59 | * 絶対ファイルパスを取得できること |
||
60 | * @dataProvider fileLinkProvider |
||
61 | */ |
||
62 | public function okFileAbsolutePath($file, $linkPath) |
||
69 | |||
70 | /** |
||
71 | * 正常系 |
||
72 | * ファイルに読み込み権限をチェックできること |
||
73 | * @test |
||
74 | * @dataProvider fileProvider |
||
75 | */ |
||
76 | public function okFileReadable($file) |
||
81 | |||
82 | /** |
||
83 | * 正常系 |
||
84 | * ファイルに書き込み権限をチェックできること |
||
85 | * @test |
||
86 | * @dataProvider fileProvider |
||
87 | */ |
||
88 | public function okFileWritable($file) |
||
93 | |||
94 | /** |
||
95 | * 正常系 |
||
96 | * ファイルに実行権限をチェックできること |
||
97 | * @test |
||
98 | * @dataProvider fileProvider |
||
99 | */ |
||
100 | public function okFileExecutable($file) |
||
105 | |||
106 | /** |
||
107 | * 正常系 |
||
108 | * ファイルであるかどうかチェックできること |
||
109 | * @test |
||
110 | * @dataProvider fileProvider |
||
111 | */ |
||
112 | public function okFile($file) |
||
117 | |||
118 | /** |
||
119 | * 正常系 |
||
120 | * ディレクトリであるかどうかチェックできること |
||
121 | * @test |
||
122 | * @dataProvider directoryProvider |
||
123 | */ |
||
124 | public function okDirectory($file) |
||
129 | |||
130 | /** |
||
131 | * 正常系 |
||
132 | * リンクであるかどうかチェックできること |
||
133 | * @test |
||
134 | * @dataProvider fileLinkProvider |
||
135 | */ |
||
136 | public function okLink($file, $linkPath) |
||
144 | |||
145 | /** |
||
146 | * 正常系 |
||
147 | * ファイルサイズを取得できること |
||
148 | * @test |
||
149 | * @dataProvider fileProvider |
||
150 | */ |
||
151 | public function okFileSize($file) |
||
155 | |||
156 | /** |
||
157 | * 正常系 |
||
158 | * ファイルを削除できること |
||
159 | * @test |
||
160 | * @dataProvider tmpFileProvider |
||
161 | */ |
||
162 | public function okFileDelete($file) |
||
168 | |||
169 | /** |
||
170 | * 正常系 |
||
171 | * ファイルサイズを取得できること |
||
172 | * @test |
||
173 | * @dataProvider tmpFileProvider |
||
174 | */ |
||
175 | public function okFileRename($file) |
||
184 | |||
185 | /** |
||
186 | * 正常系 |
||
187 | * ファイル最終更新日時を取得できること |
||
188 | * @test |
||
189 | * @dataProvider fileProvider |
||
190 | */ |
||
191 | public function okLastModified($file) |
||
195 | } |
||
196 |
The PSR-1: Basic Coding Standard recommends that a file should either introduce new symbols, that is classes, functions, constants or similar, or have side effects. Side effects are anything that executes logic, like for example printing output, changing ini settings or writing to a file.
The idea behind this recommendation is that merely auto-loading a class should not change the state of an application. It also promotes a cleaner style of programming and makes your code less prone to errors, because the logic is not spread out all over the place.
To learn more about the PSR-1, please see the PHP-FIG site on the PSR-1.