|
@@ -51,32 +51,6 @@ class CollectionFormTest extends TypeTestCase
|
|
|
$this->assertEquals(20, $form[0]->getAttribute('max_length'));
|
|
|
}
|
|
|
|
|
|
- public function testSetDataAddsPrototypeIfAllowAdd()
|
|
|
- {
|
|
|
- $form = $this->factory->create('collection', null, array(
|
|
|
- 'type' => 'field',
|
|
|
- 'options' => array(
|
|
|
- 'max_length' => 20,
|
|
|
- ),
|
|
|
- 'allow_add' => true,
|
|
|
- 'prototype' => true,
|
|
|
- ));
|
|
|
-
|
|
|
- $form->setData(array('foo@foo.com', 'foo@bar.com'));
|
|
|
- $this->assertTrue($form[0] instanceof Form);
|
|
|
- $this->assertTrue($form[1] instanceof Form);
|
|
|
- $this->assertTrue($form['$$name$$'] instanceof Form);
|
|
|
- $this->assertEquals(20, $form['$$name$$']->getAttribute('max_length'));
|
|
|
- $this->assertEquals(3, count($form));
|
|
|
-
|
|
|
- $form->setData(array('foo@baz.com'));
|
|
|
- $this->assertTrue($form[0] instanceof Form);
|
|
|
- $this->assertFalse(isset($form[1]));
|
|
|
- $this->assertTrue($form['$$name$$'] instanceof Form);
|
|
|
- $this->assertEquals(20, $form['$$name$$']->getAttribute('max_length'));
|
|
|
- $this->assertEquals(2, count($form));
|
|
|
- }
|
|
|
-
|
|
|
public function testThrowsExceptionIfObjectIsNotTraversable()
|
|
|
{
|
|
|
$form = $this->factory->create('collection', null, array(
|