Skip to content

Commit b031bd5

Browse files
committed
Added tests for Guzzle6, Curl and Socket factories
1 parent 453e59c commit b031bd5

File tree

5 files changed

+87
-0
lines changed

5 files changed

+87
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
<?php
2+
3+
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
4+
5+
use Http\HttplugBundle\ClientFactory\CurlFactory;
6+
use Http\Client\Curl\Client;
7+
use Http\Message\MessageFactory;
8+
use Http\Message\StreamFactory;
9+
10+
/**
11+
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
12+
*/
13+
class CurlFactoryTest extends \PHPUnit_Framework_TestCase
14+
{
15+
public function testCreateClient()
16+
{
17+
$factory = new CurlFactory($this->getMock(MessageFactory::class), $this->getMock(StreamFactory::class));
18+
$client = $factory->createClient();
19+
20+
$this->assertInstanceOf(Client::class, $client);
21+
}
22+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
<?php
2+
3+
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
4+
5+
use Http\HttplugBundle\ClientFactory\Guzzle6Factory;
6+
use Http\Adapter\Guzzle6\Client;
7+
8+
/**
9+
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
10+
*/
11+
class Guzzle6FactoryTest extends \PHPUnit_Framework_TestCase
12+
{
13+
public function testCreateClient()
14+
{
15+
$factory = new Guzzle6Factory();
16+
$client = $factory->createClient();
17+
18+
$this->assertInstanceOf(Client::class, $client);
19+
}
20+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
4+
5+
use Http\Adapter\React\Client;
6+
use Http\HttplugBundle\ClientFactory\ReactFactory;
7+
use Http\Message\MessageFactory;
8+
9+
/**
10+
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
11+
*/
12+
class ReactFactoryTest extends \PHPUnit_Framework_TestCase
13+
{
14+
public function testCreateClient()
15+
{
16+
$factory = new ReactFactory($this->getMock(MessageFactory::class));
17+
$client = $factory->createClient();
18+
19+
$this->assertInstanceOf(Client::class, $client);
20+
}
21+
}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
<?php
2+
3+
namespace Http\HttplugBundle\Tests\Unit\ClientFactory;
4+
5+
use Http\Client\Socket\Client;
6+
use Http\HttplugBundle\ClientFactory\SocketFactory;
7+
use Http\Message\MessageFactory;
8+
9+
/**
10+
* @author Tobias Nyholm <tobias.nyholm@gmail.com>
11+
*/
12+
class SocketFactoryTest extends \PHPUnit_Framework_TestCase
13+
{
14+
public function testCreateClient()
15+
{
16+
$factory = new SocketFactory($this->getMock(MessageFactory::class));
17+
$client = $factory->createClient();
18+
19+
$this->assertInstanceOf(Client::class, $client);
20+
}
21+
}

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,10 @@
2020
},
2121
"require-dev": {
2222
"phpunit/phpunit": "^4.5",
23+
"php-http/curl-client": "^1.0",
24+
"php-http/socket-client": "^1.0",
2325
"php-http/guzzle6-adapter": "^1.0",
26+
"php-http/react-adapter": "^0.1",
2427
"php-http/message": "^1.0",
2528
"puli/composer-plugin": "1.0.0-beta9",
2629
"symfony/symfony": "^2.7|^3.0",

0 commit comments

Comments
 (0)