1414
1515namespace chillerlan \HTTPTest \Psr7 ;
1616
17+ use chillerlan \HTTP \Psr17 ;
1718use chillerlan \HTTP \Psr7 ;
1819use chillerlan \HTTP \Psr7 \UploadedFile ;
19- use chillerlan \HTTP \Psr17 \{StreamFactory , UploadedFileFactory };
2020use InvalidArgumentException ;
2121use PHPUnit \Framework \TestCase ;
2222
@@ -27,20 +27,8 @@ class UploadedFileTest extends TestCase{
2727 */
2828 protected $ cleanup ;
2929
30- /**
31- * @var \chillerlan\HTTP\Psr17\UploadedFileFactory
32- */
33- protected $ uploadedFileFactory ;
34-
35- /**
36- * @var \chillerlan\HTTP\Psr17\StreamFactory
37- */
38- protected $ streamFactory ;
39-
4030 protected function setUp ():void {
4131 $ this ->cleanup = [];
42- $ this ->uploadedFileFactory = new UploadedFileFactory ;
43- $ this ->streamFactory = new StreamFactory ;
4432 }
4533
4634 protected function tearDown ():void {
@@ -93,8 +81,8 @@ public function testRaisesExceptionOnInvalidErrorStatus(int $status){
9381 }
9482
9583 public function testGetStreamReturnsOriginalStreamObject (){
96- $ stream = $ this -> streamFactory -> createStream ('' );
97- $ upload = $ this -> uploadedFileFactory -> createUploadedFile ($ stream , 0 , UPLOAD_ERR_OK ); // coverage
84+ $ stream = Psr17 \create_stream ('' );
85+ $ upload = new UploadedFile ($ stream , 0 , UPLOAD_ERR_OK );
9886
9987 $ this ->assertSame ($ stream , $ upload ->getStream ());
10088 }
@@ -108,7 +96,7 @@ public function testGetStreamReturnsWrappedPhpStream(){
10896 }
10997
11098 public function testSuccessful (){
111- $ stream = $ this -> streamFactory -> createStream ('Foo bar! ' );
99+ $ stream = Psr17 \create_stream ('Foo bar! ' );
112100 $ upload = new UploadedFile ($ stream , $ stream ->getSize (), UPLOAD_ERR_OK , 'filename.txt ' , 'text/plain ' );
113101
114102 $ this ->assertEquals ($ stream ->getSize (), $ upload ->getSize ());
@@ -123,7 +111,7 @@ public function testSuccessful(){
123111 }
124112
125113 public function testMoveCannotBeCalledMoreThanOnce (){
126- $ stream = $ this -> streamFactory -> createStream ('Foo bar! ' );
114+ $ stream = Psr17 \create_stream ('Foo bar! ' );
127115 $ upload = new UploadedFile ($ stream , 0 , UPLOAD_ERR_OK );
128116
129117 $ this ->cleanup [] = $ to = tempnam (sys_get_temp_dir (), 'diac ' );
@@ -136,7 +124,7 @@ public function testMoveCannotBeCalledMoreThanOnce(){
136124 }
137125
138126 public function testCannotRetrieveStreamAfterMove (){
139- $ stream = $ this -> streamFactory -> createStream ('Foo bar! ' );
127+ $ stream = Psr17 \create_stream ('Foo bar! ' );
140128 $ upload = new UploadedFile ($ stream , 0 , UPLOAD_ERR_OK );
141129
142130 $ this ->cleanup [] = $ to = tempnam (sys_get_temp_dir (), 'diac ' );
0 commit comments