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

Commit

Permalink
[#3735] Added unit test
Browse files Browse the repository at this point in the history
- Test demonstrates that factory composed by object implementing
  FormFactoryAwareInterface is not overwritten, but *is* injected with
  FormElementManager instance.
  • Loading branch information
weierophinney committed Feb 19, 2013
1 parent 08f61d5 commit c24fb6f
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions tests/ZendTest/Form/FormElementManagerTest.php
Expand Up @@ -11,6 +11,8 @@
namespace ZendTest\Form;

use Zend\ServiceManager\ServiceManager;
use Zend\Form\Factory;
use Zend\Form\Form;
use Zend\Form\FormElementManager;

/**
Expand All @@ -37,6 +39,22 @@ public function testInjectToFormFactoryAware()
$this->assertSame($this->manager, $form->getFormFactory()->getFormElementManager());
}

/**
* @group 3735
*/
public function testInjectsFormElementManagerToFormComposedByFormFactoryAwareElement()
{
$factory = new Factory();
$this->manager->setFactory('my-form', function ($elements) use ($factory) {
$form = new Form();
$form->setFormFactory($factory);
return $form;
});
$form = $this->manager->get('my-Form');
$this->assertSame($factory, $form->getFormFactory());
$this->assertSame($this->manager, $form->getFormFactory()->getFormElementManager());
}

public function testRegisteringInvalidElementRaisesException()
{
$this->setExpectedException('Zend\Form\Exception\InvalidElementException');
Expand Down

0 comments on commit c24fb6f

Please sign in to comment.