Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP

Loading…

Make Fieldset constructor consistent with parent Element class #2317

Merged
merged 1 commit into from

2 participants

@cgmartin

No description provided.

@weierophinney

Merged to release and master branches.

@weierophinney weierophinney merged commit 480c49f into zendframework:master

1 check passed

Details default The Travis build passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
View
9 library/Zend/Form/Fieldset.php
@@ -73,14 +73,13 @@ class Fieldset extends Element implements FieldsetInterface
protected $useAsBaseFieldset = false;
/**
- * Constructor
- *
- * @param null|string|int $name Optional name for the element
+ * @param null|int|string $name Optional name for the element
+ * @param array $options Optional options for the element
*/
- public function __construct($name = null)
+ public function __construct($name = null, $options = array())
{
$this->iterator = new PriorityQueue();
- parent::__construct($name);
+ parent::__construct($name, $options);
}
/**
View
10 tests/ZendTest/Form/FieldsetTest.php
@@ -104,6 +104,16 @@ public function testCanAddElementsToFieldset()
$this->assertEquals(1, count($this->fieldset));
}
+ public function testCanSetCustomOptionFromConstructor()
+ {
+ $fieldset = new Fieldset('foo', array(
+ 'custom' => 'option'
+ ));
+ $options = $fieldset->getOptions();
+ $this->assertArrayHasKey('custom', $options);
+ $this->assertEquals('option', $options['custom']);
+ }
+
public function testCanGrabElementByNameWhenNotProvidedWithAlias()
{
$element = new Element('foo');
Something went wrong with that request. Please try again.