public function testInsertForms()
 {
     $xml = new SimpleXMLElement(file_get_contents($this->getStreamPath("Config/config.xml")));
     $parser = new ConfigParser();
     $config = $parser->parseXml($xml);
     $forms = $config->getForms();
     $this->assertCount(1, $forms);
     $form = array_pop($forms);
     $this->assertEquals("theliastudiotestmodule.configuration", $form->getName());
     $this->assertEquals("TheliaStudioTestModule\\Form\\TheliaStudioTestModuleConfigForm", $form->getClass());
 }
 public function testInsertService()
 {
     $xml = new SimpleXMLElement(file_get_contents($this->getStreamPath("Config/config.xml")));
     ConfigParser::registerNamespace($xml);
     $services = $xml->xpath("//config:services/config:service");
     $this->assertCount(2, $services);
     // test action
     $action = $xml->xpath("//config:services/config:service[@id=\"action.theliastudiotestmodule.example_table_table\"]");
     $this->assertCount(1, $action);
     $action = $action[0];
     $this->assertEquals("TheliaStudioTestModule\\Action\\ExampleTableAction", $action->getAttributeAsPhp("class"));
     ConfigParser::registerNamespace($action);
     $tag = $action->xpath(".//config:tag");
     $this->assertCount(1, $tag);
     $this->assertEquals("kernel.event_subscriber", $tag[0]->getAttributeAsPhp("name"));
     // test form type
     $type = $xml->xpath("//config:services/config:service[@id=\"theliastudiotestmodule.form.type.example_table_id\"]");
     $this->assertCount(1, $type);
     $type = $type[0];
     $this->assertEquals("TheliaStudioTestModule\\Form\\Type\\ExampleTableIdType", $type->getAttributeAsPhp("class"));
     ConfigParser::registerNamespace($type);
     $tag = $type->xpath(".//config:tag");
     $this->assertCount(1, $tag);
     $this->assertEquals("thelia.form.type", $tag[0]->getAttributeAsPhp("name"));
 }
 protected function parseConfigXml($modulePath)
 {
     /**
      * Get current configuration
      */
     $configData = @file_get_contents($configPath = $modulePath . "Config" . DS . "config.xml");
     if (false === $configData) {
         throw new \Exception("missing file 'config.xml'");
     }
     $configParser = new ConfigParser();
     $xml = new SimpleXMLElement($configData);
     /** @var Config $config */
     return [$xml, $configPath, $configParser->parseXml($xml)];
 }