Exemple #1
0
 /**
  * @expectedException App\Form\Exception\InvalidArgumentException
  */
 public function testViewPath()
 {
     $element = new Element('test');
     $this->assertEquals(array(), $element->getViewPath());
     $element = new Element('test', array(), array('view_path' => array(__DIR__, __DIR__)));
     $this->assertEquals(array(__DIR__), $element->getOption('view_path'));
     $element = new Element('test', array(), array('view_path' => __DIR__ . '/../'));
     $this->assertEquals(array(realpath(__DIR__ . '/../')), $element->getOption('view_path'));
     $form = new Form('test', array(), array('view_path' => array(__DIR__)));
     $this->assertEquals(array(__DIR__), $form->getViewPath());
     $form->add($element);
     $this->assertEquals(array(realpath(__DIR__ . '/../'), __DIR__), $element->getViewPath());
     $this->assertEquals(array(__DIR__), $form->getViewPath());
     $element = new Element('test', array(), array('view_path' => './unknown'));
     $this->assertEquals('', $element->getOption('view_path'));
 }