예제 #1
0
 function testDefaultFormatDate()
 {
     $object = new EntityMock();
     $object->setName(new \DateTime('1970-01-01 12:34'));
     $options = ['property' => 'name'];
     $widget = new DateWidget();
     $this->assertEquals('01.01.1970', $widget->render($options, $object));
 }
예제 #2
0
 /**
  * Test if you try to access an not existing property, will throw an exception
  *
  * @expectedException \Enhavo\Bundle\AppBundle\Exception\PropertyNotExistsException
  */
 function testPropertyAccessIfNotExists()
 {
     $object = new EntityMock();
     $object->setName('my name is route');
     $options = ['property' => 'propertyNotExists'];
     $widget = new PropertyWidget();
     $this->assertEquals('my name is route', $widget->render($options, $object));
 }
예제 #3
0
 function testRender()
 {
     $object = new EntityMock();
     $object->setName('myName');
     $object->setId(1);
     $options = ['properties' => ['name', 'id']];
     $widget = new MultiplePropertyWidget();
     $this->assertEquals('myName,1', $widget->render($options, $object));
 }
예제 #4
0
 protected function getEntityMock()
 {
     $childOne = new EntityMock();
     $childOne->setName('one');
     $childTwo = new EntityMock();
     $childTwo->setName('two');
     $entity = new EntityMock();
     $entity->addEntity($childOne);
     $entity->addEntity($childTwo);
     return $entity;
 }