diff --git a/.travis.yml b/.travis.yml
index e439fd54..474a16bf 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -1,19 +1,17 @@
sudo: false
+
language: php
+dist: trusty
+
php:
- - 5.5
- - 5.6
- - 7.0
- - 7.1
- - hhvm
+ - 7.3
+ - 7.4
- nightly
matrix:
fast_finish: true
allow_failures:
- - php: 7.1
- - php: hhvm
- php: nightly
before_script:
diff --git a/CHANGELOG.md b/CHANGELOG.md
index f02629dc..48963d54 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -1,5 +1,17 @@
# Change Log
+## [1.2.0](https://github.com/guzzle/guzzle-services/tree/1.2.0) (2020-11-13)
+
+[Full Changelog](https://github.com/guzzle/guzzle-services/compare/1.2.0...HEAD)
+
+**Closed issues:**
+
+- Fix weird "equal equal not" operator [\#154](https://github.com/guzzle/guzzle-services/issues/154)
+
+**Merged pull requests:**
+
+- Support Guzzle 7 [\#176](https://github.com/guzzle/guzzle-services/pull/176) ([ptlevi](https://github.com/ptlevi))
+
## [1.1.3](https://github.com/guzzle/guzzle-services/tree/1.1.3) (2017-10-06)
[Full Changelog](https://github.com/guzzle/guzzle-services/compare/1.1.2...HEAD)
@@ -348,4 +360,4 @@
-\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
\ No newline at end of file
+\* *This Change Log was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
diff --git a/composer.json b/composer.json
index 645e44b2..9eb533be 100644
--- a/composer.json
+++ b/composer.json
@@ -21,12 +21,13 @@
}
],
"require": {
- "php": ">=5.5",
- "guzzlehttp/guzzle": "^6.2",
- "guzzlehttp/command": "~1.0"
+ "php": ">=7.3",
+ "guzzlehttp/guzzle": "^7.0.1",
+ "guzzlehttp/command": "^1.1.0",
+ "guzzlehttp/uri-template": "^0.2.0"
},
"require-dev": {
- "phpunit/phpunit": "~4.0"
+ "phpunit/phpunit": "~9.0"
},
"autoload": {
"psr-4": {
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
index 994e1584..a1860399 100644
--- a/phpunit.xml.dist
+++ b/phpunit.xml.dist
@@ -2,13 +2,13 @@
-
+
tests
-
-
- src
-
-
+
+
+ ./app
+
+
diff --git a/src/GuzzleClient.php b/src/GuzzleClient.php
index f419b54e..fa656a3c 100644
--- a/src/GuzzleClient.php
+++ b/src/GuzzleClient.php
@@ -99,7 +99,7 @@ public function getDescription()
*/
private function getSerializer($commandToRequestTransformer)
{
- return $commandToRequestTransformer ==! null
+ return $commandToRequestTransformer !== null
? $commandToRequestTransformer
: new Serializer($this->description);
}
@@ -114,7 +114,7 @@ private function getDeserializer($responseToResultTransformer)
{
$process = (! isset($this->config['process']) || $this->config['process'] === true);
- return $responseToResultTransformer ==! null
+ return $responseToResultTransformer !== null
? $responseToResultTransformer
: new Deserializer($this->description, $process);
}
diff --git a/src/Serializer.php b/src/Serializer.php
index 160fbc25..4f1b5aad 100644
--- a/src/Serializer.php
+++ b/src/Serializer.php
@@ -12,6 +12,8 @@
use GuzzleHttp\Command\Guzzle\RequestLocation\XmlLocation;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Uri;
+use GuzzleHttp\Psr7\UriResolver;
+use GuzzleHttp\UriTemplate\UriTemplate;
use Psr\Http\Message\RequestInterface;
/**
@@ -154,11 +156,11 @@ private function createCommandWithUri(
}
// Expand the URI template.
- $uri = \GuzzleHttp\uri_template($operation->getUri(), $variables);
+ $uri = new Uri(UriTemplate::expand($operation->getUri(), $variables));
return new Request(
- $operation->getHttpMethod(),
- Uri::resolve($this->description->getBaseUri(), $uri)
+ $operation->getHttpMethod() ?: 'GET',
+ UriResolver::resolve($this->description->getBaseUri(), $uri)
);
}
}
diff --git a/tests/DescriptionTest.php b/tests/DescriptionTest.php
index 9f73cf3d..764dfc0e 100644
--- a/tests/DescriptionTest.php
+++ b/tests/DescriptionTest.php
@@ -5,15 +5,17 @@
use GuzzleHttp\Command\Guzzle\Operation;
use GuzzleHttp\Command\Guzzle\Parameter;
use GuzzleHttp\Command\Guzzle\SchemaFormatter;
+use InvalidArgumentException;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\Description
*/
-class DescriptionTest extends \PHPUnit_Framework_TestCase
+class DescriptionTest extends TestCase
{
protected $operations;
- public function setup()
+ public function setup(): void
{
$this->operations = [
'test_command' => [
@@ -65,11 +67,9 @@ public function testCanUseResponseClass()
$this->assertNotNull($op->getResponseModel());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testRetrievingMissingModelThrowsException()
{
+ $this->expectException(InvalidArgumentException::class);
$d = new Description([]);
$d->getModel('foo');
}
@@ -105,20 +105,16 @@ public function testPersistsCustomAttributes()
$this->assertNull($d->getData('missing'));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testThrowsExceptionForMissingOperation()
{
+ $this->expectException(InvalidArgumentException::class);
$s = new Description([]);
$this->assertNull($s->getOperation('foo'));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testValidatesOperationTypes()
{
+ $this->expectException(InvalidArgumentException::class);
new Description([
'operations' => ['foo' => new \stdClass()]
]);
diff --git a/tests/DeserializerTest.php b/tests/DeserializerTest.php
index a44f9802..554b59bd 100644
--- a/tests/DeserializerTest.php
+++ b/tests/DeserializerTest.php
@@ -3,6 +3,7 @@
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Command\CommandInterface;
+use GuzzleHttp\Command\Exception\CommandException;
use GuzzleHttp\Command\Guzzle\Description;
use GuzzleHttp\Command\Guzzle\DescriptionInterface;
use GuzzleHttp\Command\Guzzle\GuzzleClient;
@@ -13,20 +14,21 @@
use GuzzleHttp\Psr7\Response;
use GuzzleHttp\Tests\Command\Guzzle\Asset\Exception\CustomCommandException;
use GuzzleHttp\Tests\Command\Guzzle\Asset\Exception\OtherCustomCommandException;
-use Predis\Response\ResponseInterface;
+use PHPUnit\Framework\MockObject\MockBuilder;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\Deserializer
*/
-class DeserializerTest extends \PHPUnit_Framework_TestCase
+class DeserializerTest extends TestCase
{
- /** @var ServiceClientInterface|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var ServiceClientInterface|MockBuilder */
private $serviceClient;
- /** @var CommandInterface|\PHPUnit_Framework_MockObject_MockObject */
+ /** @var CommandInterface|MockBuilder */
private $command;
- public function setUp()
+ public function setUp(): void
{
$this->serviceClient = $this->getMockBuilder(GuzzleClient::class)
->disableOriginalConstructor()
@@ -80,11 +82,9 @@ public function testDoNothingIfNoException()
$client->foo(['bar' => 'baz']);
}
- /**
- * @expectedException \GuzzleHttp\Tests\Command\Guzzle\Asset\Exception\CustomCommandException
- */
public function testCreateExceptionWithCode()
{
+ $this->expectException(CustomCommandException::class);
$response = new Response(404);
$mock = new MockHandler([$response]);
@@ -165,11 +165,9 @@ public function testNotCreateExceptionIfDoesNotMatchCode()
$client->foo(['bar' => 'baz']);
}
- /**
- * @expectedException \GuzzleHttp\Tests\Command\Guzzle\Asset\Exception\CustomCommandException
- */
public function testCreateExceptionWithExactMatchOfReasonPhrase()
{
+ $this->expectException(CustomCommandException::class);
$response = new Response(404, [], null, '1.1', 'Bar');
$mock = new MockHandler([$response]);
@@ -209,11 +207,9 @@ public function testCreateExceptionWithExactMatchOfReasonPhrase()
$client->foo(['bar' => 'baz']);
}
- /**
- * @expectedException \GuzzleHttp\Tests\Command\Guzzle\Asset\Exception\OtherCustomCommandException
- */
public function testFavourMostPreciseMatch()
{
+ $this->expectException(OtherCustomCommandException::class);
$response = new Response(404, [], null, '1.1', 'Bar');
$mock = new MockHandler([$response]);
@@ -254,12 +250,10 @@ public function testFavourMostPreciseMatch()
$client->foo(['bar' => 'baz']);
}
- /**
- * @expectedException \GuzzleHttp\Command\Exception\CommandException
- * @expectedExceptionMessage 404
- */
public function testDoesNotAddResultWhenExceptionIsPresent()
{
+ $this->expectExceptionMessage("404");
+ $this->expectException(CommandException::class);
$description = new Description([
'operations' => [
'foo' => [
@@ -381,6 +375,6 @@ public function testReturnsExpectedResult()
'content' => 'OK'
]
];
- $this->assertArraySubset($expected, $result['LoginResponse']);
+ $this->assertEquals($expected, $result['LoginResponse']);
}
}
diff --git a/tests/GuzzleClientTest.php b/tests/GuzzleClientTest.php
index 0e5c9d9c..4355fb3d 100644
--- a/tests/GuzzleClientTest.php
+++ b/tests/GuzzleClientTest.php
@@ -10,13 +10,14 @@
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
+use PHPUnit\Framework\TestCase;
use Psr\Http\Message\RequestInterface;
use Psr\Http\Message\ResponseInterface;
/**
* @covers \GuzzleHttp\Command\Guzzle\GuzzleClient
*/
-class GuzzleClientTest extends \PHPUnit_Framework_TestCase
+class GuzzleClientTest extends TestCase
{
public function testExecuteCommandViaMagicMethod()
{
@@ -179,8 +180,8 @@ public function testExecuteWithMultiPartLocation()
$client->doMultiPartLocation(['foo' => 'Foo']);
$multiPartRequestBody = (string) $mock->getLastRequest()->getBody();
- $this->assertContains('name="foo"', $multiPartRequestBody);
- $this->assertContains('Foo', $multiPartRequestBody);
+ $this->assertStringContainsString('name="foo"', $multiPartRequestBody);
+ $this->assertStringContainsString('Foo', $multiPartRequestBody);
$client->doMultiPartLocation([
'foo' => 'Foo',
@@ -189,20 +190,20 @@ public function testExecuteWithMultiPartLocation()
]);
$multiPartRequestBody = (string) $mock->getLastRequest()->getBody();
- $this->assertContains('name="foo"', $multiPartRequestBody);
- $this->assertContains('Foo', $multiPartRequestBody);
- $this->assertContains('name="bar"', $multiPartRequestBody);
- $this->assertContains('Bar', $multiPartRequestBody);
- $this->assertContains('name="baz"', $multiPartRequestBody);
- $this->assertContains('Baz', $multiPartRequestBody);
+ $this->assertStringContainsString('name="foo"', $multiPartRequestBody);
+ $this->assertStringContainsString('Foo', $multiPartRequestBody);
+ $this->assertStringContainsString('name="bar"', $multiPartRequestBody);
+ $this->assertStringContainsString('Bar', $multiPartRequestBody);
+ $this->assertStringContainsString('name="baz"', $multiPartRequestBody);
+ $this->assertStringContainsString('Baz', $multiPartRequestBody);
$client->doMultiPartLocation([
'file' => fopen(dirname(__FILE__) . '/Asset/test.html', 'r'),
]);
$multiPartRequestBody = (string) $mock->getLastRequest()->getBody();
- $this->assertContains('name="file"', $multiPartRequestBody);
- $this->assertContains('filename="test.html"', $multiPartRequestBody);
- $this->assertContains('
Title', $multiPartRequestBody);
+ $this->assertStringContainsString('name="file"', $multiPartRequestBody);
+ $this->assertStringContainsString('filename="test.html"', $multiPartRequestBody);
+ $this->assertStringContainsString('Title', $multiPartRequestBody);
}
public function testHasConfig()
@@ -342,12 +343,10 @@ public function testValidateDescription()
$this->assertEquals(200, $response->getStatusCode());
}
- /**
- * @expectedException \GuzzleHttp\Command\Exception\CommandException
- * @expectedExceptionMessage Validation errors: [baz] is a required string: baz
- */
public function testValidateDescriptionFailsDueMissingRequiredParameter()
{
+ $this->expectExceptionMessage("Validation errors: [baz] is a required string: baz");
+ $this->expectException(\GuzzleHttp\Command\Exception\CommandException::class);
$client = new HttpClient();
$description = new Description(
[
@@ -421,12 +420,10 @@ public function testValidateDescriptionFailsDueMissingRequiredParameter()
$this->assertEquals(200, $result['statusCode']);
}
- /**
- * @expectedException \GuzzleHttp\Command\Exception\CommandException
- * @expectedExceptionMessage Validation errors: [baz] must be of type integer
- */
public function testValidateDescriptionFailsDueTypeMismatch()
{
+ $this->expectExceptionMessage("Validation errors: [baz] must be of type integer");
+ $this->expectException(\GuzzleHttp\Command\Exception\CommandException::class);
$client = new HttpClient();
$description = new Description(
[
@@ -635,12 +632,10 @@ public function testMagicMethodExecutesCommands()
$this->assertEquals('foo', $guzzle->foo([]));
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage No operation found named Foo
- */
public function testThrowsWhenOperationNotFoundInDescription()
{
+ $this->expectExceptionMessage("No operation found named Foo");
+ $this->expectException(\InvalidArgumentException::class);
$client = new HttpClient();
$description = new Description([]);
$guzzle = new GuzzleClient(
diff --git a/tests/Handler/ValidatedDescriptionHandlerTest.php b/tests/Handler/ValidatedDescriptionHandlerTest.php
index f02396c5..c76e36f3 100644
--- a/tests/Handler/ValidatedDescriptionHandlerTest.php
+++ b/tests/Handler/ValidatedDescriptionHandlerTest.php
@@ -4,19 +4,18 @@
use GuzzleHttp\Client as HttpClient;
use GuzzleHttp\Command\Guzzle\Description;
use GuzzleHttp\Command\Guzzle\GuzzleClient;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\Handler\ValidatedDescriptionHandler
*/
-class ValidatedDescriptionHandlerTest extends \PHPUnit_Framework_TestCase
+class ValidatedDescriptionHandlerTest extends TestCase
{
- /**
- * @expectedException \GuzzleHttp\Command\Exception\CommandException
- * @expectedExceptionMessage Validation errors: [bar] is a required string
- */
public function testValidates()
{
+ $this->expectExceptionMessage("Validation errors: [bar] is a required string");
+ $this->expectException(\GuzzleHttp\Command\Exception\CommandException::class);
$description = new Description([
'operations' => [
'foo' => [
@@ -59,12 +58,10 @@ public function testSuccessfulValidationDoesNotThrow()
$client->foo([]);
}
- /**
- * @expectedException \GuzzleHttp\Command\Exception\CommandException
- * @expectedExceptionMessage Validation errors: [bar] must be of type string
- */
public function testValidatesAdditionalParameters()
{
+ $this->expectExceptionMessage("Validation errors: [bar] must be of type string");
+ $this->expectException(\GuzzleHttp\Command\Exception\CommandException::class);
$description = new Description([
'operations' => [
'foo' => [
diff --git a/tests/OperationTest.php b/tests/OperationTest.php
index 04313dd7..f8a12c84 100644
--- a/tests/OperationTest.php
+++ b/tests/OperationTest.php
@@ -1,13 +1,14 @@
assertEquals(['foo' => 'baz', 'bar' => 123], $o->getData());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMesssage Parameters must be arrays
- */
public function testEnsuresParametersAreArrays()
{
+ $this->expectExceptionMessage('Parameters must be arrays');
+ $this->expectException(\InvalidArgumentException::class);
new Operation(['parameters' => ['foo' => true]]);
}
diff --git a/tests/ParameterTest.php b/tests/ParameterTest.php
index 7bc937f3..80301959 100644
--- a/tests/ParameterTest.php
+++ b/tests/ParameterTest.php
@@ -1,13 +1,14 @@
'foo',
@@ -39,11 +40,9 @@ public function testCreatesParamFromArray()
$this->assertEquals('abc', $p->getName());
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testValidatesDescription()
{
+ $this->expectException(\InvalidArgumentException::class);
new Parameter($this->data, ['description' => 'foo']);
}
@@ -97,12 +96,10 @@ public function testFiltersValues()
$this->assertEquals('FOO', $p->filter('foo'));
}
- /**
- * @expectedException \RuntimeException
- * @expectedExceptionMessage No service description
- */
public function testRequiresServiceDescriptionForFormatting()
{
+ $this->expectExceptionMessage("No service description");
+ $this->expectException(\RuntimeException::class);
$d = $this->data;
$d['format'] = 'foo';
$p = new Parameter($d);
@@ -137,12 +134,10 @@ public function testParsesTypeValues()
$this->assertEquals('foo', $p->getType());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage A [method] value must be specified for each complex filter
- */
public function testValidatesComplexFilters()
{
+ $this->expectExceptionMessage("A [method] value must be specified for each complex filter");
+ $this->expectException(\InvalidArgumentException::class);
$p = new Parameter(['filters' => [['args' => 'foo']]]);
}
@@ -188,7 +183,7 @@ public function testAddsItems()
$this->assertInstanceOf('GuzzleHttp\Command\Guzzle\Parameter', $p->getItems());
$out = $p->toArray();
$this->assertEquals('array', $out['type']);
- $this->assertInternalType('array', $out['items']);
+ $this->assertIsArray($out['items']);
}
public function testCanRetrieveKnownPropertiesUsingDataMethod()
@@ -332,7 +327,7 @@ public function testHasProperties()
$this->assertNull($p->getProperty('wefwe'));
$properties = $p->getProperties();
- $this->assertInternalType('array', $properties);
+ $this->assertIsArray($properties);
foreach ($properties as $prop) {
$this->assertInstanceOf('GuzzleHttp\\Command\\Guzzle\\Parameter', $prop);
}
@@ -340,12 +335,10 @@ public function testHasProperties()
$this->assertEquals($data, $p->toArray());
}
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Expected a string. Got: array
- */
public function testThrowsWhenNotPassString()
{
+ $this->expectExceptionMessage("Expected a string. Got: array");
+ $this->expectException(\InvalidArgumentException::class);
$emptyParam = new Parameter();
$this->assertFalse($emptyParam->has([]));
$this->assertFalse($emptyParam->has(new \stdClass()));
diff --git a/tests/QuerySerializer/Rfc3986SerializerTest.php b/tests/QuerySerializer/Rfc3986SerializerTest.php
index 66ec75f2..0f50ab62 100644
--- a/tests/QuerySerializer/Rfc3986SerializerTest.php
+++ b/tests/QuerySerializer/Rfc3986SerializerTest.php
@@ -2,8 +2,9 @@
namespace GuzzleHttp\Tests\Command\Guzzle\QuerySerializer;
use GuzzleHttp\Command\Guzzle\QuerySerializer\Rfc3986Serializer;
+use PHPUnit\Framework\TestCase;
-class Rfc3986SerializerTest extends \PHPUnit_Framework_TestCase
+class Rfc3986SerializerTest extends TestCase
{
public function queryProvider()
{
diff --git a/tests/RequestLocation/BodyLocationTest.php b/tests/RequestLocation/BodyLocationTest.php
index 2a6418e5..93c38aa9 100644
--- a/tests/RequestLocation/BodyLocationTest.php
+++ b/tests/RequestLocation/BodyLocationTest.php
@@ -5,11 +5,12 @@
use GuzzleHttp\Command\Guzzle\Parameter;
use GuzzleHttp\Command\Guzzle\RequestLocation\BodyLocation;
use GuzzleHttp\Psr7\Request;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\BodyLocation
*/
-class BodyLocationTest extends \PHPUnit_Framework_TestCase
+class BodyLocationTest extends TestCase
{
/**
* @group RequestLocation
diff --git a/tests/RequestLocation/FormParamLocationTest.php b/tests/RequestLocation/FormParamLocationTest.php
index 016ad6b8..34b13498 100644
--- a/tests/RequestLocation/FormParamLocationTest.php
+++ b/tests/RequestLocation/FormParamLocationTest.php
@@ -7,12 +7,13 @@
use GuzzleHttp\Command\Guzzle\RequestLocation\FormParamLocation;
use GuzzleHttp\Command\Guzzle\RequestLocation\PostFieldLocation;
use GuzzleHttp\Psr7\Request;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\FormParamLocation
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\AbstractLocation
*/
-class FormParamLocationTest extends \PHPUnit_Framework_TestCase
+class FormParamLocationTest extends TestCase
{
/**
* @group RequestLocation
@@ -27,7 +28,7 @@ public function testVisitsLocation()
$operation = new Operation();
$request = $location->after($command, $request, $operation);
$this->assertEquals('foo=bar', $request->getBody()->getContents());
- $this->assertArraySubset([0 => 'application/x-www-form-urlencoded; charset=utf-8'], $request->getHeader('Content-Type'));
+ $this->assertEquals([0 => 'application/x-www-form-urlencoded; charset=utf-8'], $request->getHeader('Content-Type'));
}
/**
diff --git a/tests/RequestLocation/HeaderLocationTest.php b/tests/RequestLocation/HeaderLocationTest.php
index 2ebc2835..ba29f515 100644
--- a/tests/RequestLocation/HeaderLocationTest.php
+++ b/tests/RequestLocation/HeaderLocationTest.php
@@ -6,12 +6,13 @@
use GuzzleHttp\Command\Guzzle\Parameter;
use GuzzleHttp\Command\Guzzle\RequestLocation\HeaderLocation;
use GuzzleHttp\Psr7\Request;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\HeaderLocation
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\AbstractLocation
*/
-class HeaderLocationTest extends \PHPUnit_Framework_TestCase
+class HeaderLocationTest extends TestCase
{
/**
* @group RequestLocation
@@ -26,7 +27,7 @@ public function testVisitsLocation()
$header = $request->getHeader('foo');
$this->assertTrue(is_array($header));
- $this->assertArraySubset([0 => 'bar'], $request->getHeader('foo'));
+ $this->assertEquals([0 => 'bar'], $request->getHeader('foo'));
}
/**
@@ -47,6 +48,6 @@ public function testAddsAdditionalProperties()
$header = $request->getHeader('add');
$this->assertTrue(is_array($header));
- $this->assertArraySubset([0 => 'props'], $header);
+ $this->assertEquals([0 => 'props'], $header);
}
}
diff --git a/tests/RequestLocation/JsonLocationTest.php b/tests/RequestLocation/JsonLocationTest.php
index 359b7e29..b8cac3e2 100644
--- a/tests/RequestLocation/JsonLocationTest.php
+++ b/tests/RequestLocation/JsonLocationTest.php
@@ -6,12 +6,13 @@
use GuzzleHttp\Command\Guzzle\Parameter;
use GuzzleHttp\Command\Guzzle\RequestLocation\JsonLocation;
use GuzzleHttp\Psr7\Request;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\JsonLocation
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\AbstractLocation
*/
-class JsonLocationTest extends \PHPUnit_Framework_TestCase
+class JsonLocationTest extends TestCase
{
/**
* @group RequestLocation
@@ -26,7 +27,7 @@ public function testVisitsLocation()
$operation = new Operation();
$request = $location->after($command, $request, $operation);
$this->assertEquals('{"foo":"bar"}', $request->getBody()->getContents());
- $this->assertArraySubset([0 => 'application/json'], $request->getHeader('Content-Type'));
+ $this->assertEquals([0 => 'application/json'], $request->getHeader('Content-Type'));
}
/**
diff --git a/tests/RequestLocation/MultiPartLocationTest.php b/tests/RequestLocation/MultiPartLocationTest.php
index a2e7faf6..63cce9d1 100644
--- a/tests/RequestLocation/MultiPartLocationTest.php
+++ b/tests/RequestLocation/MultiPartLocationTest.php
@@ -7,11 +7,12 @@
use GuzzleHttp\Command\Guzzle\RequestLocation\MultiPartLocation;
use GuzzleHttp\Command\Guzzle\RequestLocation\PostFileLocation;
use GuzzleHttp\Psr7\Request;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\MultiPartLocation
*/
-class MultiPartLocationTest extends \PHPUnit_Framework_TestCase
+class MultiPartLocationTest extends TestCase
{
/**
* @group RequestLocation
diff --git a/tests/RequestLocation/QueryLocationTest.php b/tests/RequestLocation/QueryLocationTest.php
index 7ccfbd8a..4bf4b25d 100644
--- a/tests/RequestLocation/QueryLocationTest.php
+++ b/tests/RequestLocation/QueryLocationTest.php
@@ -7,12 +7,13 @@
use GuzzleHttp\Command\Guzzle\RequestLocation\QueryLocation;
use GuzzleHttp\Psr7;
use GuzzleHttp\Psr7\Request;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\QueryLocation
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\AbstractLocation
*/
-class QueryLocationTest extends \PHPUnit_Framework_TestCase
+class QueryLocationTest extends TestCase
{
public function queryProvider()
{
diff --git a/tests/RequestLocation/XmlLocationTest.php b/tests/RequestLocation/XmlLocationTest.php
index ce789d4e..26603585 100644
--- a/tests/RequestLocation/XmlLocationTest.php
+++ b/tests/RequestLocation/XmlLocationTest.php
@@ -13,11 +13,12 @@
use GuzzleHttp\Middleware;
use GuzzleHttp\Psr7\Request;
use GuzzleHttp\Psr7\Response;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\RequestLocation\XmlLocation
*/
-class XmlLocationTest extends \PHPUnit_Framework_TestCase
+class XmlLocationTest extends TestCase
{
/**
* @group RequestLocation
@@ -39,7 +40,7 @@ public function testVisitsLocation()
$this->assertEquals('' . "\n"
. 'bartest' . "\n", $xml);
$header = $request->getHeader('Content-Type');
- $this->assertArraySubset([0 => 'application/xml'], $header);
+ $this->assertEquals([0 => 'application/xml'], $header);
}
/**
@@ -59,7 +60,7 @@ public function testCreatesBodyForEmptyDocument()
. '' . "\n", $xml);
$header = $request->getHeader('Content-Type');
- $this->assertArraySubset([0 => 'application/xml'], $header);
+ $this->assertEquals([0 => 'application/xml'], $header);
}
/**
@@ -84,7 +85,7 @@ public function testAddsAdditionalParameters()
$this->assertEquals('' . "\n"
. 'barbarboo' . "\n", $xml);
$header = $request->getHeader('Content-Type');
- $this->assertArraySubset([0 => 'test'], $header);
+ $this->assertEquals([0 => 'test'], $header);
}
/**
@@ -512,10 +513,10 @@ public function testSerializesXml(array $operation, array $input, $xml)
$request = $transaction['request'];
if (empty($input)) {
if ($request->hasHeader('Content-Type')) {
- $this->assertArraySubset([0 => ''], $request->getHeader('Content-Type'));
+ $this->assertEquals([0 => ''], $request->getHeader('Content-Type'));
}
} else {
- $this->assertArraySubset([0 => 'application/xml'], $request->getHeader('Content-Type'));
+ $this->assertEquals([0 => 'application/xml'], $request->getHeader('Content-Type'));
}
$body = str_replace(["\n", ""], '', (string) $request->getBody());
diff --git a/tests/ResponseLocation/BodyLocationTest.php b/tests/ResponseLocation/BodyLocationTest.php
index 36eda588..eb76f296 100644
--- a/tests/ResponseLocation/BodyLocationTest.php
+++ b/tests/ResponseLocation/BodyLocationTest.php
@@ -5,12 +5,13 @@
use GuzzleHttp\Command\Guzzle\ResponseLocation\BodyLocation;
use GuzzleHttp\Command\Result;
use GuzzleHttp\Psr7\Response;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\BodyLocation
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\AbstractLocation
*/
-class BodyLocationTest extends \PHPUnit_Framework_TestCase
+class BodyLocationTest extends TestCase
{
/**
* @group ResponseLocation
diff --git a/tests/ResponseLocation/HeaderLocationTest.php b/tests/ResponseLocation/HeaderLocationTest.php
index 763af38a..9677f64a 100644
--- a/tests/ResponseLocation/HeaderLocationTest.php
+++ b/tests/ResponseLocation/HeaderLocationTest.php
@@ -5,12 +5,13 @@
use GuzzleHttp\Command\Guzzle\ResponseLocation\HeaderLocation;
use GuzzleHttp\Command\Result;
use GuzzleHttp\Psr7\Response;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\HeaderLocation
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\AbstractLocation
*/
-class HeaderLocationTest extends \PHPUnit_Framework_TestCase
+class HeaderLocationTest extends TestCase
{
/**
* @group ResponseLocation
diff --git a/tests/ResponseLocation/JsonLocationTest.php b/tests/ResponseLocation/JsonLocationTest.php
index 52a44a8d..5dc3d059 100644
--- a/tests/ResponseLocation/JsonLocationTest.php
+++ b/tests/ResponseLocation/JsonLocationTest.php
@@ -10,12 +10,13 @@
use GuzzleHttp\Command\ResultInterface;
use GuzzleHttp\Handler\MockHandler;
use GuzzleHttp\Psr7\Response;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\JsonLocation
* @covers \GuzzleHttp\Command\Guzzle\Deserializer
*/
-class JsonLocationTest extends \PHPUnit_Framework_TestCase
+class JsonLocationTest extends TestCase
{
/**
diff --git a/tests/ResponseLocation/ReasonPhraseLocationTest.php b/tests/ResponseLocation/ReasonPhraseLocationTest.php
index bfe77172..af9b293b 100644
--- a/tests/ResponseLocation/ReasonPhraseLocationTest.php
+++ b/tests/ResponseLocation/ReasonPhraseLocationTest.php
@@ -5,12 +5,13 @@
use GuzzleHttp\Command\Guzzle\ResponseLocation\ReasonPhraseLocation;
use GuzzleHttp\Command\Result;
use GuzzleHttp\Psr7\Response;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\ReasonPhraseLocation
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\AbstractLocation
*/
-class ReasonPhraseLocationTest extends \PHPUnit_Framework_TestCase
+class ReasonPhraseLocationTest extends TestCase
{
/**
* @group ResponseLocation
diff --git a/tests/ResponseLocation/StatusCodeLocationTest.php b/tests/ResponseLocation/StatusCodeLocationTest.php
index 1946e62b..c1f2795d 100644
--- a/tests/ResponseLocation/StatusCodeLocationTest.php
+++ b/tests/ResponseLocation/StatusCodeLocationTest.php
@@ -5,12 +5,13 @@
use GuzzleHttp\Command\Guzzle\ResponseLocation\StatusCodeLocation;
use GuzzleHttp\Command\Result;
use GuzzleHttp\Psr7\Response;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\StatusCodeLocation
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\AbstractLocation
*/
-class StatusCodeLocationTest extends \PHPUnit_Framework_TestCase
+class StatusCodeLocationTest extends TestCase
{
/**
* @group ResponseLocation
diff --git a/tests/ResponseLocation/XmlLocationTest.php b/tests/ResponseLocation/XmlLocationTest.php
index 4e398ba9..366ac16f 100644
--- a/tests/ResponseLocation/XmlLocationTest.php
+++ b/tests/ResponseLocation/XmlLocationTest.php
@@ -5,11 +5,12 @@
use GuzzleHttp\Command\Guzzle\ResponseLocation\XmlLocation;
use GuzzleHttp\Command\Result;
use GuzzleHttp\Psr7\Response;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\ResponseLocation\XmlLocation
*/
-class XmlLocationTest extends \PHPUnit_Framework_TestCase
+class XmlLocationTest extends TestCase
{
/**
* @group ResponseLocation
diff --git a/tests/SchemaFormatterTest.php b/tests/SchemaFormatterTest.php
index a8e051ac..a6cb791e 100644
--- a/tests/SchemaFormatterTest.php
+++ b/tests/SchemaFormatterTest.php
@@ -2,11 +2,12 @@
namespace GuzzleHttp\Tests\Command\Guzzle;
use GuzzleHttp\Command\Guzzle\SchemaFormatter;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\SchemaFormatter
*/
-class SchemaFormatterTest extends \PHPUnit_Framework_TestCase
+class SchemaFormatterTest extends TestCase
{
public function dateTimeProvider()
{
@@ -42,11 +43,9 @@ public function testFilters($value, $format, $result)
$this->assertEquals($result, (new SchemaFormatter)->format($format, $value));
}
- /**
- * @expectedException \InvalidArgumentException
- */
public function testValidatesDateTimeInput()
{
+ $this->expectException(\InvalidArgumentException::class);
(new SchemaFormatter)->format('date-time', false);
}
@@ -55,6 +54,6 @@ public function testEnsuresTimestampsAreIntegers()
$t = time();
$result = (new SchemaFormatter)->format('timestamp', $t);
$this->assertSame($t, $result);
- $this->assertInternalType('int', $result);
+ $this->assertIsInt($result);
}
}
diff --git a/tests/SchemaValidatorTest.php b/tests/SchemaValidatorTest.php
index 6db3d24c..c53062d3 100644
--- a/tests/SchemaValidatorTest.php
+++ b/tests/SchemaValidatorTest.php
@@ -4,16 +4,17 @@
use GuzzleHttp\Command\Guzzle\Parameter;
use GuzzleHttp\Command\Guzzle\SchemaValidator;
use GuzzleHttp\Command\ToArrayInterface;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\SchemaValidator
*/
-class SchemaValidatorTest extends \PHPUnit_Framework_TestCase
+class SchemaValidatorTest extends TestCase
{
/** @var SchemaValidator */
protected $validator;
- public function setUp()
+ public function setUp(): void
{
$this->validator = new SchemaValidator();
}
@@ -65,7 +66,7 @@ public function testCorrectlyConvertsParametersToArrayWhenArraysArePresent()
{
$param = $this->getComplexParam();
$result = $param->toArray();
- $this->assertInternalType('array', $result['items']);
+ $this->assertIsArray($result['items']);
$this->assertEquals('array', $result['type']);
$this->assertInstanceOf('GuzzleHttp\Command\Guzzle\Parameter', $param->getItems());
}
diff --git a/tests/SerializerTest.php b/tests/SerializerTest.php
index 1d3a5a1e..1b0609fe 100644
--- a/tests/SerializerTest.php
+++ b/tests/SerializerTest.php
@@ -5,11 +5,12 @@
use GuzzleHttp\Command\Guzzle\Description;
use GuzzleHttp\Command\Guzzle\Serializer;
use GuzzleHttp\Psr7\Request;
+use PHPUnit\Framework\TestCase;
/**
* @covers \GuzzleHttp\Command\Guzzle\Serializer
*/
-class SerializerTest extends \PHPUnit_Framework_TestCase
+class SerializerTest extends TestCase
{
public function testAllowsUriTemplates()
{