Skip to content

Commit

Permalink
Combine form type unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
tienvx committed Feb 7, 2022
1 parent 2c1dfbb commit 1f547ef
Showing 1 changed file with 5 additions and 13 deletions.
18 changes: 5 additions & 13 deletions tests/Form/CollectionJsTypeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@ public function testCustomOptions()
$form = $this->factory
->create(static::TESTED_TYPE, null, [
'entry_type' => TextType::class,
'prototype' => true,
'prototype_data' => 'New Tag Placeholder',
'allow_add' => false,
'allow_delete' => false,
'allow_move_up' => true,
'allow_move_down' => true,
'call_post_add_on_init' => true,
Expand All @@ -49,25 +53,13 @@ public function testCustomOptions()
], $form->getConfig()->getOption('entry_options'));

$view = $form->createView();
$this->assertInstanceOf(FormView::class, $view->vars['prototype']);
$this->assertTrue($view->vars['allow_move_up']);
$this->assertTrue($view->vars['allow_move_down']);
$this->assertTrue($view->vars['call_post_add_on_init']);
$this->assertSame('__test__', $view->vars['prototype_name']);
}

public function testDontAllowAdd()
{
$form = $this->factory
->create(static::TESTED_TYPE, null, [
'entry_type' => TextType::class,
'allow_add' => false,
])
;

$view = $form->createView();
$this->assertInstanceOf(FormView::class, $view->vars['prototype']);
}

public function testDisablePrototype()
{
$this->expectExceptionObject(new InvalidConfigurationException(sprintf('You must enable prototype for form type %s.', static::TESTED_TYPE)));
Expand Down

0 comments on commit 1f547ef

Please sign in to comment.