From b031bd575065136531ea330304149aedcc634b14 Mon Sep 17 00:00:00 2001 From: Tobias Nyholm Date: Wed, 2 Mar 2016 09:02:24 +0100 Subject: [PATCH] Added tests for Guzzle6, Curl and Socket factories --- Tests/Unit/ClientFactory/CurlFactoryTest.php | 22 +++++++++++++++++++ .../Unit/ClientFactory/Guzzle6FactoryTest.php | 20 +++++++++++++++++ Tests/Unit/ClientFactory/ReactFactoryTest.php | 21 ++++++++++++++++++ .../Unit/ClientFactory/SocketFactoryTest.php | 21 ++++++++++++++++++ composer.json | 3 +++ 5 files changed, 87 insertions(+) create mode 100644 Tests/Unit/ClientFactory/CurlFactoryTest.php create mode 100644 Tests/Unit/ClientFactory/Guzzle6FactoryTest.php create mode 100644 Tests/Unit/ClientFactory/ReactFactoryTest.php create mode 100644 Tests/Unit/ClientFactory/SocketFactoryTest.php diff --git a/Tests/Unit/ClientFactory/CurlFactoryTest.php b/Tests/Unit/ClientFactory/CurlFactoryTest.php new file mode 100644 index 00000000..f3bd18fa --- /dev/null +++ b/Tests/Unit/ClientFactory/CurlFactoryTest.php @@ -0,0 +1,22 @@ + + */ +class CurlFactoryTest extends \PHPUnit_Framework_TestCase +{ + public function testCreateClient() + { + $factory = new CurlFactory($this->getMock(MessageFactory::class), $this->getMock(StreamFactory::class)); + $client = $factory->createClient(); + + $this->assertInstanceOf(Client::class, $client); + } +} diff --git a/Tests/Unit/ClientFactory/Guzzle6FactoryTest.php b/Tests/Unit/ClientFactory/Guzzle6FactoryTest.php new file mode 100644 index 00000000..08222147 --- /dev/null +++ b/Tests/Unit/ClientFactory/Guzzle6FactoryTest.php @@ -0,0 +1,20 @@ + + */ +class Guzzle6FactoryTest extends \PHPUnit_Framework_TestCase +{ + public function testCreateClient() + { + $factory = new Guzzle6Factory(); + $client = $factory->createClient(); + + $this->assertInstanceOf(Client::class, $client); + } +} diff --git a/Tests/Unit/ClientFactory/ReactFactoryTest.php b/Tests/Unit/ClientFactory/ReactFactoryTest.php new file mode 100644 index 00000000..9ddd53e8 --- /dev/null +++ b/Tests/Unit/ClientFactory/ReactFactoryTest.php @@ -0,0 +1,21 @@ + + */ +class ReactFactoryTest extends \PHPUnit_Framework_TestCase +{ + public function testCreateClient() + { + $factory = new ReactFactory($this->getMock(MessageFactory::class)); + $client = $factory->createClient(); + + $this->assertInstanceOf(Client::class, $client); + } +} diff --git a/Tests/Unit/ClientFactory/SocketFactoryTest.php b/Tests/Unit/ClientFactory/SocketFactoryTest.php new file mode 100644 index 00000000..3caadbf6 --- /dev/null +++ b/Tests/Unit/ClientFactory/SocketFactoryTest.php @@ -0,0 +1,21 @@ + + */ +class SocketFactoryTest extends \PHPUnit_Framework_TestCase +{ + public function testCreateClient() + { + $factory = new SocketFactory($this->getMock(MessageFactory::class)); + $client = $factory->createClient(); + + $this->assertInstanceOf(Client::class, $client); + } +} diff --git a/composer.json b/composer.json index e99419f4..39ce7cd4 100644 --- a/composer.json +++ b/composer.json @@ -20,7 +20,10 @@ }, "require-dev": { "phpunit/phpunit": "^4.5", + "php-http/curl-client": "^1.0", + "php-http/socket-client": "^1.0", "php-http/guzzle6-adapter": "^1.0", + "php-http/react-adapter": "^0.1", "php-http/message": "^1.0", "puli/composer-plugin": "1.0.0-beta9", "symfony/symfony": "^2.7|^3.0",