public function testWithFieldsCascadeTranslationDomain() { $this->admin->setModelManager($this->modelManager); $this->modelManager->expects($this->once())->method('getNewFieldDescriptionInstance')->with('class', 'foo', array('translation_domain' => 'Foobar', 'type' => 'bar'))->will($this->returnValue($this->fieldDescription)); $this->contractor->expects($this->once())->method('getDefaultOptions')->will($this->returnValue(array())); $this->admin->setLabelTranslatorStrategy($this->labelTranslatorStrategy); $this->formMapper->with('foobar', array('translation_domain' => 'Foobar'))->add('foo', 'bar')->end(); $this->assertSame(array('default' => array('collapsed' => false, 'class' => false, 'description' => false, 'translation_domain' => 'Foobar', 'name' => 'default', 'auto_created' => true, 'groups' => array('foobar'), 'tab' => true)), $this->admin->getFormTabs()); $this->assertSame(array('foobar' => array('collapsed' => false, 'class' => false, 'description' => false, 'translation_domain' => 'Foobar', 'name' => 'foobar', 'fields' => array('foo' => 'foo'))), $this->admin->getFormGroups()); }
public function testIfFalseCombination() { $this->contractor->expects($this->once())->method('getDefaultOptions')->will($this->returnValue(array())); $this->formMapper->ifFalse(true)->add('foo', 'bar')->ifEnd()->add('baz', 'foobaz'); $this->assertFalse($this->formMapper->has('foo')); $this->assertTrue($this->formMapper->has('baz')); }
public function testKeys() { $this->contractor->expects($this->any())->method('getDefaultOptions')->will($this->returnValue(array())); $this->formMapper->add('foo', 'bar')->add('baz', 'foobaz'); $this->assertSame(array('foo', 'baz'), $this->formMapper->keys()); }