Ejemplo n.º 1
0
 public function testParserFixture()
 {
     $parser = new ConfigFormParser();
     $config = $parser->loadFromYaml(__DIR__ . "/fixtures/config-form.yml");
     $this->assertCount(3, $config);
     $first = $config[0];
     $second = $config[1];
     $third = $config[2];
     $this->assertEquals("var_name", $first->getName());
     $this->assertEquals("VarName", $first->getCamelizedName());
     $this->assertEquals("VAR_NAME", $first->getConstantName());
     $this->assertEquals("text", $first->getType());
     $this->assertTrue($first->isRequired());
     $this->assertFalse($first->hasSize());
     $this->assertEquals("var_name2", $second->getName());
     $this->assertEquals("integer", $second->getType());
     $this->assertEquals("var_name3", $third->getName());
     $this->assertEquals("text", $third->getType());
     $this->assertFalse($third->isRequired());
     $this->assertEquals(5, $third->getMinSize());
     $this->assertEquals(20, $third->getMaxSize());
     $this->assertTrue($third->hasMinSize());
     $this->assertTrue($third->hasMaxSize());
 }
Ejemplo n.º 2
0
 protected function readConfigFormFile($modulePath)
 {
     $fullPath = $modulePath . "Config" . DS . static::CONFIG_FORM_FILE;
     $parser = new ConfigFormParser();
     return $parser->loadFromYaml($fullPath);
 }