Skip to content

Added tests for Guzzle6, Curl, React and Socket factories #61

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 3, 2016
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions Tests/Unit/ClientFactory/CurlFactoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?php

namespace Http\HttplugBundle\Tests\Unit\ClientFactory;

use Http\HttplugBundle\ClientFactory\CurlFactory;
use Http\Client\Curl\Client;
use Http\Message\MessageFactory;
use Http\Message\StreamFactory;

/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
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);
}
}
20 changes: 20 additions & 0 deletions Tests/Unit/ClientFactory/Guzzle6FactoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<?php

namespace Http\HttplugBundle\Tests\Unit\ClientFactory;

use Http\HttplugBundle\ClientFactory\Guzzle6Factory;
use Http\Adapter\Guzzle6\Client;

/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
class Guzzle6FactoryTest extends \PHPUnit_Framework_TestCase
{
public function testCreateClient()
{
$factory = new Guzzle6Factory();
$client = $factory->createClient();

$this->assertInstanceOf(Client::class, $client);
}
}
21 changes: 21 additions & 0 deletions Tests/Unit/ClientFactory/ReactFactoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Http\HttplugBundle\Tests\Unit\ClientFactory;

use Http\Adapter\React\Client;
use Http\HttplugBundle\ClientFactory\ReactFactory;
use Http\Message\MessageFactory;

/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
class ReactFactoryTest extends \PHPUnit_Framework_TestCase
{
public function testCreateClient()
{
$factory = new ReactFactory($this->getMock(MessageFactory::class));
$client = $factory->createClient();

$this->assertInstanceOf(Client::class, $client);
}
}
21 changes: 21 additions & 0 deletions Tests/Unit/ClientFactory/SocketFactoryTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Http\HttplugBundle\Tests\Unit\ClientFactory;

use Http\Client\Socket\Client;
use Http\HttplugBundle\ClientFactory\SocketFactory;
use Http\Message\MessageFactory;

/**
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
*/
class SocketFactoryTest extends \PHPUnit_Framework_TestCase
{
public function testCreateClient()
{
$factory = new SocketFactory($this->getMock(MessageFactory::class));
$client = $factory->createClient();

$this->assertInstanceOf(Client::class, $client);
}
}
3 changes: 3 additions & 0 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down