Skip to content
This repository was archived by the owner on Jan 29, 2020. It is now read-only.

Commit 2e7fce1

Browse files
committed
Merge branch 'hotfix/268'
Close #268
2 parents 1fe1554 + 09cf051 commit 2e7fce1

22 files changed

+261
-261
lines changed

test/CallbackStreamTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public function testToString()
4545
});
4646

4747
$ret = $stream->__toString();
48-
$this->assertEquals('foobarbaz', $ret);
48+
$this->assertSame('foobarbaz', $ret);
4949
}
5050

5151
public function testClose()
@@ -170,7 +170,7 @@ public function testGetContents()
170170
});
171171

172172
$ret = $stream->getContents();
173-
$this->assertEquals('foobarbaz', $ret);
173+
$this->assertSame('foobarbaz', $ret);
174174
}
175175

176176
public function testGetMetadata()
@@ -179,7 +179,7 @@ public function testGetMetadata()
179179
});
180180

181181
$ret = $stream->getMetadata('stream_type');
182-
$this->assertEquals('callback', $ret);
182+
$this->assertSame('callback', $ret);
183183

184184
$ret = $stream->getMetadata('seekable');
185185
$this->assertFalse($ret);
@@ -217,6 +217,6 @@ public function testAllowsArbitraryPhpCallbacks($callback, $expected)
217217
{
218218
$stream = new CallbackStream($callback);
219219
$contents = $stream->getContents();
220-
$this->assertEquals($expected, $contents);
220+
$this->assertSame($expected, $contents);
221221
}
222222
}

test/HeaderSecurityTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function getFilterValues()
5050
*/
5151
public function testFiltersValuesPerRfc7230($value, $expected)
5252
{
53-
$this->assertEquals($expected, HeaderSecurity::filter($value));
53+
$this->assertSame($expected, HeaderSecurity::filter($value));
5454
}
5555

5656
public function validateValues()

test/MessageTraitTest.php

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,14 +30,14 @@ public function setUp()
3030

3131
public function testProtocolHasAcceptableDefault()
3232
{
33-
$this->assertEquals('1.1', $this->message->getProtocolVersion());
33+
$this->assertSame('1.1', $this->message->getProtocolVersion());
3434
}
3535

3636
public function testProtocolMutatorReturnsCloneWithChanges()
3737
{
3838
$message = $this->message->withProtocolVersion('1.0');
3939
$this->assertNotSame($this->message, $message);
40-
$this->assertEquals('1.0', $message->getProtocolVersion());
40+
$this->assertSame('1.0', $message->getProtocolVersion());
4141
}
4242

4343

@@ -89,21 +89,21 @@ public function testGetHeaderReturnsHeaderValueAsArray()
8989
{
9090
$message = $this->message->withHeader('X-Foo', ['Foo', 'Bar']);
9191
$this->assertNotSame($this->message, $message);
92-
$this->assertEquals(['Foo', 'Bar'], $message->getHeader('X-Foo'));
92+
$this->assertSame(['Foo', 'Bar'], $message->getHeader('X-Foo'));
9393
}
9494

9595
public function testGetHeaderLineReturnsHeaderValueAsCommaConcatenatedString()
9696
{
9797
$message = $this->message->withHeader('X-Foo', ['Foo', 'Bar']);
9898
$this->assertNotSame($this->message, $message);
99-
$this->assertEquals('Foo,Bar', $message->getHeaderLine('X-Foo'));
99+
$this->assertSame('Foo,Bar', $message->getHeaderLine('X-Foo'));
100100
}
101101

102102
public function testGetHeadersKeepsHeaderCaseSensitivity()
103103
{
104104
$message = $this->message->withHeader('X-Foo', ['Foo', 'Bar']);
105105
$this->assertNotSame($this->message, $message);
106-
$this->assertEquals([ 'X-Foo' => [ 'Foo', 'Bar' ] ], $message->getHeaders());
106+
$this->assertSame([ 'X-Foo' => [ 'Foo', 'Bar' ] ], $message->getHeaders());
107107
}
108108

109109
public function testGetHeadersReturnsCaseWithWhichHeaderFirstRegistered()
@@ -112,7 +112,7 @@ public function testGetHeadersReturnsCaseWithWhichHeaderFirstRegistered()
112112
->withHeader('X-Foo', 'Foo')
113113
->withAddedHeader('x-foo', 'Bar');
114114
$this->assertNotSame($this->message, $message);
115-
$this->assertEquals([ 'X-Foo' => [ 'Foo', 'Bar' ] ], $message->getHeaders());
115+
$this->assertSame([ 'X-Foo' => [ 'Foo', 'Bar' ] ], $message->getHeaders());
116116
}
117117

118118
public function testHasHeaderReturnsFalseIfHeaderIsNotPresent()
@@ -133,7 +133,7 @@ public function testAddHeaderAppendsToExistingHeader()
133133
$this->assertNotSame($this->message, $message);
134134
$message2 = $message->withAddedHeader('X-Foo', 'Bar');
135135
$this->assertNotSame($message, $message2);
136-
$this->assertEquals('Foo,Bar', $message2->getHeaderLine('X-Foo'));
136+
$this->assertSame('Foo,Bar', $message2->getHeaderLine('X-Foo'));
137137
}
138138

139139
public function testHeaderExistsIfWithNoValues()
@@ -178,7 +178,7 @@ public function testHeaderRemovalIsCaseInsensitive()
178178
$this->assertFalse($message2->hasHeader('X-Foo'));
179179

180180
$headers = $message2->getHeaders();
181-
$this->assertEquals(0, count($headers));
181+
$this->assertSame(0, count($headers));
182182
}
183183

184184
public function invalidGeneralHeaderValues()
@@ -228,8 +228,8 @@ public function testWithHeaderReplacesDifferentCapitalization()
228228
{
229229
$this->message = $this->message->withHeader('X-Foo', ['foo']);
230230
$new = $this->message->withHeader('X-foo', ['bar']);
231-
$this->assertEquals(['bar'], $new->getHeader('x-foo'));
232-
$this->assertEquals(['X-foo' => ['bar']], $new->getHeaders());
231+
$this->assertSame(['bar'], $new->getHeader('x-foo'));
232+
$this->assertSame(['X-foo' => ['bar']], $new->getHeaders());
233233
}
234234

235235
/**
@@ -311,13 +311,13 @@ public function testDoesNotAllowCRLFInjectionWhenCallingWithAddedHeader($name, $
311311
public function testWithHeaderAllowsHeaderContinuations()
312312
{
313313
$message = $this->message->withHeader('X-Foo-Bar', "value,\r\n second value");
314-
$this->assertEquals("value,\r\n second value", $message->getHeaderLine('X-Foo-Bar'));
314+
$this->assertSame("value,\r\n second value", $message->getHeaderLine('X-Foo-Bar'));
315315
}
316316

317317
public function testWithAddedHeaderAllowsHeaderContinuations()
318318
{
319319
$message = $this->message->withAddedHeader('X-Foo-Bar', "value,\r\n second value");
320-
$this->assertEquals("value,\r\n second value", $message->getHeaderLine('X-Foo-Bar'));
320+
$this->assertSame("value,\r\n second value", $message->getHeaderLine('X-Foo-Bar'));
321321
}
322322

323323
public function numericHeaderValuesProvider()

test/PhpInputStreamTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function getFileContents()
3838
public function assertStreamContents($test, $message = null)
3939
{
4040
$content = $this->getFileContents();
41-
$this->assertEquals($content, $test, $message);
41+
$this->assertSame($content, $test, $message);
4242
}
4343

4444
public function testStreamIsNeverWritable()
@@ -61,7 +61,7 @@ public function testGetContentsReturnsRemainingContentsOfStream()
6161
$remainder = $this->stream->getContents();
6262

6363
$contents = $this->getFileContents();
64-
$this->assertEquals(substr($contents, 128), $remainder);
64+
$this->assertSame(substr($contents, 128), $remainder);
6565
}
6666

6767
public function testGetContentsReturnCacheWhenReachedEof()

test/RelativeStreamTest.php

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function testToString()
3030

3131
$stream = new RelativeStream($decorated->reveal(), 100);
3232
$ret = $stream->__toString();
33-
$this->assertEquals('foobarbaz', $ret);
33+
$this->assertSame('foobarbaz', $ret);
3434
}
3535

3636
public function testClose()
@@ -47,7 +47,7 @@ public function testDetach()
4747
$decorated->detach()->shouldBeCalled()->willReturn(250);
4848
$stream = new RelativeStream($decorated->reveal(), 100);
4949
$ret = $stream->detach();
50-
$this->assertEquals(250, $ret);
50+
$this->assertSame(250, $ret);
5151
}
5252

5353
public function testGetSize()
@@ -56,7 +56,7 @@ public function testGetSize()
5656
$decorated->getSize()->shouldBeCalled()->willReturn(250);
5757
$stream = new RelativeStream($decorated->reveal(), 100);
5858
$ret = $stream->getSize();
59-
$this->assertEquals(150, $ret);
59+
$this->assertSame(150, $ret);
6060
}
6161

6262
public function testTell()
@@ -65,7 +65,7 @@ public function testTell()
6565
$decorated->tell()->shouldBeCalled()->willReturn(188);
6666
$stream = new RelativeStream($decorated->reveal(), 100);
6767
$ret = $stream->tell();
68-
$this->assertEquals(88, $ret);
68+
$this->assertSame(88, $ret);
6969
}
7070

7171
public function testIsSeekable()
@@ -74,7 +74,7 @@ public function testIsSeekable()
7474
$decorated->isSeekable()->shouldBeCalled()->willReturn(true);
7575
$stream = new RelativeStream($decorated->reveal(), 100);
7676
$ret = $stream->isSeekable();
77-
$this->assertEquals(true, $ret);
77+
$this->assertSame(true, $ret);
7878
}
7979

8080
public function testIsWritable()
@@ -83,7 +83,7 @@ public function testIsWritable()
8383
$decorated->isWritable()->shouldBeCalled()->willReturn(true);
8484
$stream = new RelativeStream($decorated->reveal(), 100);
8585
$ret = $stream->isWritable();
86-
$this->assertEquals(true, $ret);
86+
$this->assertSame(true, $ret);
8787
}
8888

8989
public function testIsReadable()
@@ -92,7 +92,7 @@ public function testIsReadable()
9292
$decorated->isReadable()->shouldBeCalled()->willReturn(false);
9393
$stream = new RelativeStream($decorated->reveal(), 100);
9494
$ret = $stream->isReadable();
95-
$this->assertEquals(false, $ret);
95+
$this->assertSame(false, $ret);
9696
}
9797

9898
public function testSeek()
@@ -101,7 +101,7 @@ public function testSeek()
101101
$decorated->seek(126, SEEK_SET)->shouldBeCalled()->willReturn(0);
102102
$stream = new RelativeStream($decorated->reveal(), 100);
103103
$ret = $stream->seek(26);
104-
$this->assertEquals(0, $ret);
104+
$this->assertSame(0, $ret);
105105
}
106106

107107
public function testRewind()
@@ -110,7 +110,7 @@ public function testRewind()
110110
$decorated->seek(100, SEEK_SET)->shouldBeCalled()->willReturn(0);
111111
$stream = new RelativeStream($decorated->reveal(), 100);
112112
$ret = $stream->rewind();
113-
$this->assertEquals(0, $ret);
113+
$this->assertSame(0, $ret);
114114
}
115115

116116
public function testWrite()
@@ -120,7 +120,7 @@ public function testWrite()
120120
$decorated->write("foobaz")->shouldBeCalled()->willReturn(6);
121121
$stream = new RelativeStream($decorated->reveal(), 100);
122122
$ret = $stream->write("foobaz");
123-
$this->assertEquals(6, $ret);
123+
$this->assertSame(6, $ret);
124124
}
125125

126126
public function testRead()
@@ -130,7 +130,7 @@ public function testRead()
130130
$decorated->read(3)->shouldBeCalled()->willReturn("foo");
131131
$stream = new RelativeStream($decorated->reveal(), 100);
132132
$ret = $stream->read(3);
133-
$this->assertEquals("foo", $ret);
133+
$this->assertSame("foo", $ret);
134134
}
135135

136136
public function testGetContents()
@@ -140,7 +140,7 @@ public function testGetContents()
140140
$decorated->getContents()->shouldBeCalled()->willReturn("foo");
141141
$stream = new RelativeStream($decorated->reveal(), 100);
142142
$ret = $stream->getContents();
143-
$this->assertEquals("foo", $ret);
143+
$this->assertSame("foo", $ret);
144144
}
145145

146146
public function testGetMetadata()
@@ -149,7 +149,7 @@ public function testGetMetadata()
149149
$decorated->getMetadata("bar")->shouldBeCalled()->willReturn("foo");
150150
$stream = new RelativeStream($decorated->reveal(), 100);
151151
$ret = $stream->getMetadata("bar");
152-
$this->assertEquals("foo", $ret);
152+
$this->assertSame("foo", $ret);
153153
}
154154

155155
public function testWriteRaisesExceptionWhenPointerIsBehindOffset()
@@ -200,6 +200,6 @@ public function testCanReadContentFromNotSeekableResource()
200200
$decorated->getContents()->willReturn('CONTENTS');
201201

202202
$stream = new RelativeStream($decorated->reveal(), 3);
203-
$this->assertEquals('CONTENTS', $stream->__toString());
203+
$this->assertSame('CONTENTS', $stream->__toString());
204204
}
205205
}

test/Request/SerializerTest.php

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function testSerializesBasicRequest()
3030
->withAddedHeader('Accept', 'text/html');
3131

3232
$message = Serializer::toString($request);
33-
$this->assertEquals(
33+
$this->assertSame(
3434
"GET /foo/bar?baz=bat HTTP/1.1\r\nHost: example.com\r\nAccept: text/html",
3535
$message
3636
);
@@ -91,12 +91,12 @@ public function testCanDeserializeRequestWithOriginForm($line, $requestTarget, $
9191
$message = $line . "\r\nX-Foo-Bar: Baz\r\n\r\nContent";
9292
$request = Serializer::fromString($message);
9393

94-
$this->assertEquals('GET', $request->getMethod());
95-
$this->assertEquals($requestTarget, $request->getRequestTarget());
94+
$this->assertSame('GET', $request->getMethod());
95+
$this->assertSame($requestTarget, $request->getRequestTarget());
9696

9797
$uri = $request->getUri();
9898
foreach ($expectations as $method => $expect) {
99-
$this->assertEquals($expect, $uri->{$method}());
99+
$this->assertSame($expect, $uri->{$method}());
100100
}
101101
}
102102

@@ -156,40 +156,40 @@ public function testCanDeserializeRequestWithAbsoluteForm($line, $requestTarget,
156156
$message = $line . "\r\nX-Foo-Bar: Baz\r\n\r\nContent";
157157
$request = Serializer::fromString($message);
158158

159-
$this->assertEquals('GET', $request->getMethod());
159+
$this->assertSame('GET', $request->getMethod());
160160

161-
$this->assertEquals($requestTarget, $request->getRequestTarget());
161+
$this->assertSame($requestTarget, $request->getRequestTarget());
162162

163163
$uri = $request->getUri();
164164
foreach ($expectations as $method => $expect) {
165-
$this->assertEquals($expect, $uri->{$method}());
165+
$this->assertSame($expect, $uri->{$method}());
166166
}
167167
}
168168

169169
public function testCanDeserializeRequestWithAuthorityForm()
170170
{
171171
$message = "CONNECT www.example.com:80 HTTP/1.1\r\nX-Foo-Bar: Baz";
172172
$request = Serializer::fromString($message);
173-
$this->assertEquals('CONNECT', $request->getMethod());
174-
$this->assertEquals('www.example.com:80', $request->getRequestTarget());
173+
$this->assertSame('CONNECT', $request->getMethod());
174+
$this->assertSame('www.example.com:80', $request->getRequestTarget());
175175

176176
$uri = $request->getUri();
177-
$this->assertNotEquals('www.example.com', $uri->getHost());
178-
$this->assertNotEquals(80, $uri->getPort());
177+
$this->assertNotSame('www.example.com', $uri->getHost());
178+
$this->assertNotSame(80, $uri->getPort());
179179
}
180180

181181
public function testCanDeserializeRequestWithAsteriskForm()
182182
{
183183
$message = "OPTIONS * HTTP/1.1\r\nHost: www.example.com";
184184
$request = Serializer::fromString($message);
185-
$this->assertEquals('OPTIONS', $request->getMethod());
186-
$this->assertEquals('*', $request->getRequestTarget());
185+
$this->assertSame('OPTIONS', $request->getMethod());
186+
$this->assertSame('*', $request->getRequestTarget());
187187

188188
$uri = $request->getUri();
189-
$this->assertNotEquals('www.example.com', $uri->getHost());
189+
$this->assertNotSame('www.example.com', $uri->getHost());
190190

191191
$this->assertTrue($request->hasHeader('Host'));
192-
$this->assertEquals('www.example.com', $request->getHeaderLine('Host'));
192+
$this->assertSame('www.example.com', $request->getHeaderLine('Host'));
193193
}
194194

195195
public function invalidRequestLines()
@@ -224,7 +224,7 @@ public function testCanDeserializeResponseWithMultipleHeadersOfSameName()
224224

225225
$this->assertTrue($request->hasHeader('X-Foo-Bar'));
226226
$values = $request->getHeader('X-Foo-Bar');
227-
$this->assertEquals(['Baz', 'Bat'], $values);
227+
$this->assertSame(['Baz', 'Bat'], $values);
228228
}
229229

230230
public function headersWithContinuationLines()
@@ -246,7 +246,7 @@ public function testCanDeserializeResponseWithHeaderContinuations($text)
246246
$this->assertInstanceOf(Request::class, $request);
247247

248248
$this->assertTrue($request->hasHeader('X-Foo-Bar'));
249-
$this->assertEquals('Baz;Bat', $request->getHeaderLine('X-Foo-Bar'));
249+
$this->assertSame('Baz;Bat', $request->getHeaderLine('X-Foo-Bar'));
250250
}
251251

252252
public function messagesWithInvalidHeaders()

0 commit comments

Comments
 (0)