|
@@ 16-31 (lines=16) @@
|
| 13 |
|
*/ |
| 14 |
|
class ElasticaServiceProviderTest extends \PHPUnit_Framework_TestCase |
| 15 |
|
{ |
| 16 |
|
public function testCreateService() |
| 17 |
|
{ |
| 18 |
|
$testedInstance = new ElasticaServiceProvider(); |
| 19 |
|
|
| 20 |
|
$container = $this->prophesize(ContainerInterface::class); |
| 21 |
|
$container->get(Client::class.'.host')->willReturn('localhost'); |
| 22 |
|
$container->get(Client::class.'.port')->willReturn(9200); |
| 23 |
|
|
| 24 |
|
$services = $testedInstance->getServices(); |
| 25 |
|
|
| 26 |
|
$client = $services[Client::class]($container->reveal()); |
| 27 |
|
|
| 28 |
|
$this->assertInstanceOf(Client::class, $client); |
| 29 |
|
$this->assertEquals('localhost', $client->getConfig('host')); |
| 30 |
|
$this->assertEquals(9200, $client->getConfig('port')); |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
public function testCreateServiceWithPrefix() |
| 34 |
|
{ |
|
@@ 33-48 (lines=16) @@
|
| 30 |
|
$this->assertEquals(9200, $client->getConfig('port')); |
| 31 |
|
} |
| 32 |
|
|
| 33 |
|
public function testCreateServiceWithPrefix() |
| 34 |
|
{ |
| 35 |
|
$testedInstance = new ElasticaServiceProvider('prefix'); |
| 36 |
|
|
| 37 |
|
$container = $this->prophesize(ContainerInterface::class); |
| 38 |
|
$container->get(Client::class.'.prefix.host')->willReturn('localhost'); |
| 39 |
|
$container->get(Client::class.'.prefix.port')->willReturn(9200); |
| 40 |
|
|
| 41 |
|
$services = $testedInstance->getServices(); |
| 42 |
|
|
| 43 |
|
$client = $services[Client::class.'.prefix']($container->reveal()); |
| 44 |
|
|
| 45 |
|
$this->assertInstanceOf(Client::class, $client); |
| 46 |
|
$this->assertEquals('localhost', $client->getConfig('host')); |
| 47 |
|
$this->assertEquals(9200, $client->getConfig('port')); |
| 48 |
|
} |
| 49 |
|
} |
| 50 |
|
|