From a1789ddde42033f1b05cc4929491214ee6e79383 Mon Sep 17 00:00:00 2001 From: Pierre Schmitz Date: Thu, 17 Dec 2015 09:15:42 +0100 Subject: Update to MediaWiki 1.26.0 --- .../Test/Transport/AbstractTransportTest.php | 80 ++++++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/AbstractTransportTest.php (limited to 'vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/AbstractTransportTest.php') diff --git a/vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/AbstractTransportTest.php b/vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/AbstractTransportTest.php new file mode 100644 index 00000000..20573cc7 --- /dev/null +++ b/vendor/ruflin/elastica/test/lib/Elastica/Test/Transport/AbstractTransportTest.php @@ -0,0 +1,80 @@ + 'Http')), + array(array('type' => new Http())), + array(new Http()), + ); + } + + /** + * @group unit + * @dataProvider getValidDefinitions + */ + public function testCanCreateTransportInstances($transport) + { + $connection = new Connection(); + $params = array(); + $transport = AbstractTransport::create($transport, $connection, $params); + $this->assertInstanceOf('Elastica\Transport\AbstractTransport', $transport); + $this->assertSame($connection, $transport->getConnection()); + } + + public function getInvalidDefinitions() + { + return array( + array(array('transport' => 'Http')), + array('InvalidTransport'), + ); + } + + /** + * @group unit + * @dataProvider getInvalidDefinitions + * @expectedException Elastica\Exception\InvalidException + * @expectedExceptionMessage Invalid transport + */ + public function testThrowsExecptionOnInvalidTransportDefinition($transport) + { + AbstractTransport::create($transport, new Connection()); + } + + /** + * @group unit + */ + public function testCanInjectParamsWhenUsingArray() + { + $connection = new Connection(); + $params = array( + 'param1' => 'some value', + 'param3' => 'value3', + ); + + $transport = AbstractTransport::create(array( + 'type' => 'Http', + 'param1' => 'value1', + 'param2' => 'value2', + ), $connection, $params); + + $this->assertSame('value1', $transport->getParam('param1')); + $this->assertSame('value2', $transport->getParam('param2')); + $this->assertSame('value3', $transport->getParam('param3')); + } +} -- cgit v1.2.3-54-g00ecf