1
1
<?php
2
+
2
3
namespace WebStream \IO \Test ;
3
4
4
5
require_once dirname (__FILE__ ) . '/../File.php ' ;
@@ -229,23 +230,25 @@ public function okConsoleWriteOffsetLength()
229
230
* 異常系
230
231
* ファイルオブジェクト、ファイルパス以外を指定した場合、例外が発生すること
231
232
* @test
232
- * @expectedException WebStream\Exception\Extend\InvalidArgumentException
233
233
*/
234
234
public function ngInvalidFileType ()
235
235
{
236
+ $ this ->expectException (\WebStream \Exception \Extend \InvalidArgumentException::class);
237
+
236
238
$ stream = new FileOutputStream (1 );
237
- $ this ->assertTrue ( false );
239
+ $ this ->fail ( );
238
240
}
239
241
240
242
/**
241
243
* 異常系
242
244
* ファイルがロックされている状態でストリームオブジェクトを作成した場合、例外が発生すること
243
245
* @test
244
246
* @dataProvider writeProvider
245
- * @expectedException WebStream\Exception\Extend\IOException
246
247
*/
247
248
public function ngAlreadyFileLocked ($ filePath )
248
249
{
250
+ $ this ->expectException (\WebStream \Exception \Extend \IOException::class);
251
+
249
252
@unlink ($ filePath );
250
253
// ファイルを作る
251
254
$ stream = new FileOutputStream ($ filePath );
@@ -259,18 +262,19 @@ public function ngAlreadyFileLocked($filePath)
259
262
flock ($ resource , LOCK_EX );
260
263
261
264
new FileOutputStream ($ filePath );
262
- $ this ->assertTrue ( false );
265
+ $ this ->fail ( );
263
266
}
264
267
265
268
/**
266
269
* 異常系
267
270
* flush済みの状態でflushすると例外が発生すること
268
271
* @test
269
272
* @dataProvider writeProvider
270
- * @expectedException WebStream\Exception\Extend\IOException
271
273
*/
272
274
public function ngInvalidFlush ($ filePath )
273
275
{
276
+ $ this ->expectException (\WebStream \Exception \Extend \IOException::class);
277
+
274
278
@unlink ($ filePath );
275
279
$ stream = new FileOutputStream ($ filePath );
276
280
$ writer = new OutputStreamWriter ($ stream );
@@ -279,6 +283,6 @@ public function ngInvalidFlush($filePath)
279
283
$ writer ->close ();
280
284
281
285
$ writer ->flush ();
282
- $ this ->assertTrue ( false );
286
+ $ this ->fail ( );
283
287
}
284
288
}
0 commit comments