Skip to content
This repository has been archived by the owner on May 8, 2024. It is now read-only.

Commit

Permalink
Merge pull request zendframework#1 from Ocramius/test/zendframework#6132
Browse files Browse the repository at this point in the history
-form-element-manager-multiple-shared-element-init

Tests for zendframework#6132 form element manager multiple shared element init
  • Loading branch information
Danielss89 committed Apr 14, 2014
2 parents 204c4d9 + afc40d9 commit 253e31f
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions tests/ZendTest/Form/FormElementManagerTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,4 +104,23 @@ public function testArrayOptionsCreationOptions()
$this->assertEquals('element', $element->getName(), 'Invokable CNAME');
$this->assertEquals('bar', $element->getLabel(), 'Specified options in array[options]');
}

/**
* @group 6132
*/
public function testSharedFormElementsAreNotInitializedMultipleTimes()
{
$element = $this->getMock('Zend\Form\Element', array('init'));

$element->expects($this->once())->method('init');

$this->manager->setFactory('sharedElement', function () use ($element) {
return $element;
});

$this->manager->setShared('sharedElement', true);

$this->manager->get('sharedElement');
$this->manager->get('sharedElement');
}
}

0 comments on commit 253e31f

Please sign in to comment.