Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

[#3735] Added unit test

- Test demonstrates that factory composed by object implementing
  FormFactoryAwareInterface is not overwritten, but *is* injected with
  FormElementManager instance.
  • Loading branch information...
commit c24fb6fdd55672e31d239849464695f5ec6ceae3 1 parent 08f61d5
@weierophinney weierophinney authored
Showing with 18 additions and 0 deletions.
  1. +18 −0 tests/ZendTest/Form/FormElementManagerTest.php
View
18 tests/ZendTest/Form/FormElementManagerTest.php
@@ -11,6 +11,8 @@
namespace ZendTest\Form;
use Zend\ServiceManager\ServiceManager;
+use Zend\Form\Factory;
+use Zend\Form\Form;
use Zend\Form\FormElementManager;
/**
@@ -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');
Please sign in to comment.
Something went wrong with that request. Please try again.