Exemplo n.º 1
0
 /**
  * @param DateTime|DateInterval $value
  */
 public function setValue($value)
 {
     if ($value instanceof DateInterval) {
         $value = (new DateTime())->setTime(0, 0, 0)->add($value);
     }
     parent::setValue($value);
 }
Exemplo n.º 2
0
 public function testRender()
 {
     $field = new CM_FormField_Text(['name' => 'foo']);
     $field->setValue('bar');
     $render = new CM_Frontend_Render();
     $doc = $this->_renderFormField($field, null, $render);
     /** @var CM_Frontend_Render $render */
     $autoId = $render->getGlobalResponse()->getTreeRoot()->getValue()->getAutoId();
     $this->assertSame($autoId, $doc->getAttribute('id'));
     $this->assertSame(1, $doc->find('input[name="foo"]')->count());
     $this->assertSame('bar', $doc->find('input[name="foo"]')->getAttribute('value'));
 }