Skip to content

Commit 056eea4

Browse files
committed
Use annotations instead of expect exception methods
1 parent 40b3c9e commit 056eea4

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

tests/UploadedFileTest.php

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,19 +21,21 @@ public function failtyErrorProvider()
2121

2222
/**
2323
* @dataProvider failtyErrorProvider
24+
* @expectedException \InvalidArgumentException
25+
* @expectedExceptionMessage Invalid error code, must be an UPLOAD_ERR_* constant
2426
*/
2527
public function testFailtyError($error)
2628
{
27-
self::expectException('\InvalidArgumentException');
28-
self::expectExceptionMessage('Invalid error code, must be an UPLOAD_ERR_* constant');
2929
$stream = new BufferStream();
3030
new UploadedFile($stream, 0, $error, 'foo.bar', 'foo/bar');
3131
}
3232

33+
/**
34+
* @expectedException \RuntimeException
35+
* @expectedExceptionMessage Not implemented
36+
*/
3337
public function testNoMoveFile()
3438
{
35-
self::expectException('\RuntimeException');
36-
self::expectExceptionMessage('Not implemented');
3739
$stream = new BufferStream();
3840
$uploadedFile = new UploadedFile($stream, 0, UPLOAD_ERR_OK, 'foo.bar', 'foo/bar');
3941
$uploadedFile->moveTo('bar.foo');
@@ -50,10 +52,12 @@ public function testGetters()
5052
self::assertSame('foo/bar', $uploadedFile->getClientMediaType());
5153
}
5254

55+
/**
56+
* @expectedException \RuntimeException
57+
* @expectedExceptionMessage Cannot retrieve stream due to upload error
58+
*/
5359
public function testGetStreamOnFailedUpload()
5460
{
55-
self::expectException('\RuntimeException');
56-
self::expectExceptionMessage('Cannot retrieve stream due to upload error');
5761
$stream = new BufferStream();
5862
$uploadedFile = new UploadedFile($stream, 0, UPLOAD_ERR_NO_FILE, 'foo.bar', 'foo/bar');
5963
$uploadedFile->getStream();

0 commit comments

Comments
 (0)