示例#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));
 }
 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;
 }