예제 #1
0
 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());
 }
예제 #2
0
 public function testWithFieldsCascadeTranslationDomain()
 {
     $this->contractor->expects($this->once())->method('getDefaultOptions')->will($this->returnValue(array()));
     $this->formMapper->with('foobar', array('translation_domain' => 'Foobar'))->add('foo', 'bar')->end();
     $fieldDescription = $this->admin->getFormFieldDescription('foo');
     $this->assertEquals('foo', $fieldDescription->getName());
     $this->assertEquals('bar', $fieldDescription->getType());
     $this->assertEquals('Foobar', $fieldDescription->getTranslationDomain());
     $this->assertTrue($this->formMapper->has('foo'));
     $this->assertEquals(array('default' => array('collapsed' => false, 'class' => false, 'description' => false, 'translation_domain' => 'Foobar', 'auto_created' => true, 'groups' => array('foobar'), 'tab' => true, 'name' => 'default', 'box_class' => 'box box-primary')), $this->admin->getFormTabs());
     $this->assertEquals(array('foobar' => array('collapsed' => false, 'class' => false, 'description' => false, 'translation_domain' => 'Foobar', 'fields' => array('foo' => 'foo'), 'name' => 'foobar', 'box_class' => 'box box-primary')), $this->admin->getFormGroups());
 }
 public function testGroupRemovingWithTabAndWithTabRemoving()
 {
     $this->formMapper->tab('mytab')->with('foobar');
     $this->formMapper->removeGroup('foobar', 'mytab', true);
     $this->assertSame(array(), $this->admin->getFormGroups());
     $this->assertSame(array(), $this->admin->getFormTabs());
 }