Skip to content

Commit ef431f5

Browse files
Merge branch '3.4' into 4.3
* 3.4: Fix tests Fix deprecated phpunit annotation
1 parent e0dc98d commit ef431f5

File tree

1 file changed

+12
-24
lines changed

1 file changed

+12
-24
lines changed

Tests/HttpClientTraitTest.php

Lines changed: 12 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -176,39 +176,31 @@ public function testAuthBearerOption()
176176
$this->assertSame(['Authorization: Bearer foobar'], $options['normalized_headers']['authorization']);
177177
}
178178

179-
/**
180-
* @expectedException \Symfony\Component\HttpClient\Exception\InvalidArgumentException
181-
* @expectedExceptionMessage Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, object given.
182-
*/
183179
public function testInvalidAuthBearerOption()
184180
{
181+
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
182+
$this->expectExceptionMessage('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, object given.');
185183
self::prepareRequest('POST', 'http://example.com', ['auth_bearer' => new \stdClass()], HttpClientInterface::OPTIONS_DEFAULTS);
186184
}
187185

188-
/**
189-
* @expectedException \Symfony\Component\HttpClient\Exception\InvalidArgumentException
190-
* @expectedExceptionMessage Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, invalid string given.
191-
*/
192186
public function testInvalidAuthBearerValue()
193187
{
188+
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
189+
$this->expectExceptionMessage('Option "auth_bearer" must be a string containing only characters from the base 64 alphabet, invalid string given.');
194190
self::prepareRequest('POST', 'http://example.com', ['auth_bearer' => "a\nb"], HttpClientInterface::OPTIONS_DEFAULTS);
195191
}
196192

197-
/**
198-
* @expectedException \Symfony\Component\HttpClient\Exception\InvalidArgumentException
199-
* @expectedExceptionMessage Define either the "auth_basic" or the "auth_bearer" option, setting both is not supported.
200-
*/
201193
public function testSetAuthBasicAndBearerOptions()
202194
{
195+
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
196+
$this->expectExceptionMessage('Define either the "auth_basic" or the "auth_bearer" option, setting both is not supported.');
203197
self::prepareRequest('POST', 'http://example.com', ['auth_bearer' => 'foo', 'auth_basic' => 'foo:bar'], HttpClientInterface::OPTIONS_DEFAULTS);
204198
}
205199

206-
/**
207-
* @expectedException \Symfony\Component\HttpClient\Exception\InvalidArgumentException
208-
* @expectedExceptionMessage Define either the "json" or the "body" option, setting both is not supported
209-
*/
210200
public function testSetJSONAndBodyOptions()
211201
{
202+
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
203+
$this->expectExceptionMessage('Define either the "json" or the "body" option, setting both is not supported');
212204
self::prepareRequest('POST', 'http://example.com', ['json' => ['foo' => 'bar'], 'body' => '<html/>'], HttpClientInterface::OPTIONS_DEFAULTS);
213205
}
214206

@@ -247,21 +239,17 @@ public function testNormalizePeerFingerprint($fingerprint, $expected)
247239
self::assertSame($expected, $this->normalizePeerFingerprint($fingerprint));
248240
}
249241

250-
/**
251-
* @expectedException \Symfony\Component\HttpClient\Exception\InvalidArgumentException
252-
* @expectedExceptionMessage Cannot auto-detect fingerprint algorithm for "foo".
253-
*/
254242
public function testNormalizePeerFingerprintException()
255243
{
244+
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
245+
$this->expectExceptionMessage('Cannot auto-detect fingerprint algorithm for "foo".');
256246
$this->normalizePeerFingerprint('foo');
257247
}
258248

259-
/**
260-
* @expectedException \Symfony\Component\HttpClient\Exception\InvalidArgumentException
261-
* @expectedExceptionMessage Option "peer_fingerprint" must be string or array, object given.
262-
*/
263249
public function testNormalizePeerFingerprintTypeException()
264250
{
251+
$this->expectException('Symfony\Component\HttpClient\Exception\InvalidArgumentException');
252+
$this->expectExceptionMessage('Option "peer_fingerprint" must be string or array, object given.');
265253
$fingerprint = new \stdClass();
266254

267255
$this->normalizePeerFingerprint($fingerprint);

0 commit comments

Comments
 (0)