public function testFactory() { $factory = new ThriftFactory(array('test' => array('definition' => 'Test', 'className' => 'TestService', 'namespace' => 'ThriftModel\\Test'))); $this->assertInstanceOf('ThriftModel\\Test\\Test', $factory->getInstance('ThriftModel\\Test\\Test')); $this->assertInstanceOf('ThriftModel\\Test\\Test', $factory->getInstance('ThriftModel\\Test\\Test', array())); $this->assertInstanceOf('ThriftModel\\Test\\State', $factory->getInstance('ThriftModel\\Test\\State')); $this->assertInstanceOf('ThriftModel\\Test\\InvalidValueException', $factory->getInstance('ThriftModel\\Test\\InvalidValueException')); $this->assertInstanceOf('ThriftModel\\Test\\TestServiceProcessor', $factory->getProcessorInstance('test', null)); $this->assertInstanceOf('ThriftModel\\Test\\TestServiceClient', $factory->getClientInstance('test', null)); }
/** * Instanciate Thrift Model classes * @param string $classe * @param mixed $param * @return mixed */ public function getFactory($classe, $param = null) { return $this->factory->getInstance($classe, $param); }