Skip to content

Commit 6ef750b

Browse files
committed
Add tests for Factory
1 parent 0572189 commit 6ef750b

2 files changed

Lines changed: 26 additions & 0 deletions

File tree

src/Factory.php

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,16 @@ public function createClient($url = null)
2525

2626
$connector = new UnixConnector($this->loop, $url);
2727

28+
// create HttpClient for React 0.4/0.3 (code coverage will be achieved by testing both versions)
29+
// @codeCoverageIgnoreStart
2830
$ref = new \ReflectionClass('React\HttpClient\Client');
2931
if ($ref->getConstructor()->getNumberOfRequiredParameters() == 2) {
3032
// react/http-client:0.4 removed the $loop parameter
3133
$http = new HttpClient($connector, $connector);
3234
} else {
3335
$http = new HttpClient($this->loop, $connector, $connector);
3436
}
37+
// @codeCoverageIgnoreEnd
3538

3639
$sender = new Sender($http);
3740

tests/FactoryTest.php

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
<?php
2+
3+
use Clue\React\Docker\Factory;
4+
use React\EventLoop\Factory as LoopFactory;
5+
6+
class FactoryTest extends TestCase
7+
{
8+
private $loop;
9+
private $factory;
10+
11+
public function setUp()
12+
{
13+
$this->loop = LoopFactory::create();
14+
$this->factory = new Factory($this->loop);
15+
}
16+
17+
public function testCreateClientDefault()
18+
{
19+
$client = $this->factory->createClient();
20+
21+
$this->assertInstanceOf('Clue\React\Docker\Client', $client);
22+
}
23+
}

0 commit comments

Comments
 (0)