Skip to content

Commit 981fc30

Browse files
committed
fixed compatibility with PHP7
1 parent 934c6fd commit 981fc30

File tree

6 files changed

+15
-16
lines changed

6 files changed

+15
-16
lines changed

src/PHPixie/HTTP/Messages.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ public function stream($uri, $mode = 'r')
9191

9292
public function stringStream($string = '')
9393
{
94-
return new Messages\Stream\String($string);
94+
return new Messages\Stream\StringStream($string);
9595
}
9696

9797
public function uri($uri)

src/PHPixie/HTTP/Messages/Stream/String.php renamed to src/PHPixie/HTTP/Messages/Stream/StringStream.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
use Psr\Http\Message\StreamInterface;
66
use RuntimeException;
77

8-
class String implements StreamInterface
8+
class StringStream implements StreamInterface
99
{
1010
protected $string;
1111

tests/PHPixie/Tests/HTTP/Messages/Stream/StringTest.php renamed to tests/PHPixie/Tests/HTTP/Messages/Stream/StringStreamTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33
namespace PHPixie\Tests\HTTP\Messages\Stream;
44

55
/**
6-
* @coversDefaultClass PHPixie\HTTP\Messages\Stream\String
6+
* @coversDefaultClass PHPixie\HTTP\Messages\Stream\StringStream
77
*/
8-
class StringTest extends \PHPixie\Tests\HTTP\Messages\StreamTest
8+
class StringStreamTest extends \PHPixie\Tests\HTTP\Messages\StreamTest
99
{
1010
protected $string = 'pixie';
1111

1212
public function setUp()
1313
{
14-
$this->stream = new \PHPixie\HTTP\Messages\Stream\String($this->string);
14+
$this->stream = new \PHPixie\HTTP\Messages\Stream\StringStream($this->string);
1515
}
1616

1717
/**
@@ -20,7 +20,7 @@ public function setUp()
2020
*/
2121
public function testConstruct()
2222
{
23-
$stream = new \PHPixie\HTTP\Messages\Stream\String();
23+
$stream = new \PHPixie\HTTP\Messages\Stream\StringStream();
2424
$this->assertSame('', (string) $stream);
2525
}
2626

tests/PHPixie/Tests/HTTP/Messages/UploadedFile/ImplementationTest.php

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -104,16 +104,15 @@ public function testMove()
104104
*/
105105
public function testInvalidFileSize()
106106
{
107-
$this->file = 'not_existing';
108-
$uploadedFile = $this->uploadedFile();
109-
110107
$methods = array(
111-
'getClientMediaType',
112-
'getSize'
108+
'getClientMediaType' => 'getFileType',
109+
'getSize' => 'getFileSize'
113110
);
114111

115-
foreach($methods as $method) {
116-
$this->assertException(function() use($uploadedFile) {
112+
$uploadedFile = $this->uploadedFile;
113+
foreach($methods as $method => $failMethod) {
114+
$this->method($this->uploadedFile, $failMethod, false, array(), 0);
115+
$this->assertException(function() use($uploadedFile, $method) {
117116
$uploadedFile->$method();
118117
}, '\RuntimeException');
119118
}

tests/PHPixie/Tests/HTTP/MessagesTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,7 @@ public function testStringStream()
149149
$stream = $this->messages->stringStream('test');
150150
$this->assertInstance(
151151
$stream,
152-
'\PHPixie\HTTP\Messages\Stream\String',
152+
'\PHPixie\HTTP\Messages\Stream\StringStream',
153153
array(
154154
'string' => 'test'
155155
)
@@ -158,7 +158,7 @@ public function testStringStream()
158158
$stream = $this->messages->stringStream();
159159
$this->assertInstance(
160160
$stream,
161-
'\PHPixie\HTTP\Messages\Stream\String',
161+
'\PHPixie\HTTP\Messages\Stream\StringStream',
162162
array(
163163
'string' => ''
164164
)

tests/PHPixie/Tests/HTTP/ResponsesTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ protected function prepareResponse($body, $headerArray = array(), $statusCode =
186186

187187
protected function getStringStream()
188188
{
189-
return $this->quickMock('\PHPixie\HTTP\Messages\Stream\String');
189+
return $this->quickMock('\PHPixie\HTTP\Messages\Stream\StringStream');
190190
}
191191

192192
protected function getStream()

0 commit comments

Comments
 (0)