/** * @param string $gateway * @return KVDutil_Gateway */ public function getGateway($gateway) { if (!array_key_exists($gateway, $this->gateways)) { $this->gateways[$gateway] = $this->factory->createGateway($gateway); } return $this->gateways[$gateway]; }
public function testGatewayInjection() { $config = array('KVDutil_GatewayTestGateway' => array('url' => 'http://test.vioe.be/gateway', 'username' => 'TESTUSER', 'pwd' => 'TESTPWD', 'factory' => array('class' => 'KVDutil_GatewayTestGatewayFactory', 'method' => 'create'))); $gatewayFactory = new KVDutil_GatewayFactory($config); $gateway = $gatewayFactory->createGateway('KVDutil_GatewayTestGateway'); $this->assertNotNull($gateway); $this->assertInstanceOf('KVDutil_Gateway', $gateway); }