Пример #1
0
 public function testGetFactotyFromExistentXmlTagMapped()
 {
     try {
         /* @var $factoryManager \NFSe\Service\FactoryManager */
         $factoryManager = \NFSeTest\Bootstrap::getServiceManager()->get('NFSe\\Service\\FactoryManager');
         $entity = $factoryManager->get('AbstractTag');
         $this->assertInstanceOf("\\NFSe\\XML\\Factory\\AbstractFactory", $entity);
     } catch (\NFSe\Exception\InexistentXMLTagException $ex) {
         $this->fail("The 'AbstractTag' tag is not mapped");
     }
 }
Пример #2
0
 public function testPassBuildEntity()
 {
     $xml = file_get_contents(__DIR__ . '/../../../xml-tests/abstractentity.xml');
     $xmlObject = new \SimpleXMLElement($xml);
     $tagName = $xmlObject->getName();
     try {
         /* @var $factoryManager \NFSe\Service\FactoryManager */
         $factoryManager = \NFSeTest\Bootstrap::getServiceManager()->get('NFSe\\Service\\FactoryManager');
         $factory = $factoryManager->get($tagName);
         $entity = $factory->buildEntity($xmlObject);
         $this->assertInstanceOf("\\NFSe\\XML\\Entity\\AbstractEntity", $entity);
     } catch (\NFSe\Exception\InexistentXMLTagException $ex) {
         $this->fail("The '{$tagName}' tag is not mapped");
     }
 }