@@ 24-45 (lines=22) @@ | ||
21 | class PetkoparaFilterGeneratorTest extends GeneratorTest |
|
22 | { |
|
23 | ||
24 | public function testGenerateForm() |
|
25 | { |
|
26 | $this->generateFormFilter(false); |
|
27 | $this->assertTrue(file_exists($this->tmpDir . '/Form/PostFilterType.php')); |
|
28 | $content = file_get_contents($this->tmpDir . '/Form/PostFilterType.php'); |
|
29 | ||
30 | $this->assertContains("->add('title', Filters\TextFilterType::class)", $content); |
|
31 | $this->assertContains("->add('createdAt', Filters\DateFilterType::class)", $content); |
|
32 | $this->assertContains("->add('publishedAt', Filters\TextFilterType::class)", $content); |
|
33 | $this->assertContains("->add('updatedAt', Filters\DateTimeFilterType::class)", $content); |
|
34 | $this->assertContains("->add('parent', Filters\EntityFilterType::class", $content); |
|
35 | $this->assertContains("'class' => 'FooBundle\Entity\Parent',", $content); |
|
36 | $this->assertContains("'choice_label' => 'name',", $content); |
|
37 | $this->assertContains('class PostFilterType extends AbstractType', $content); |
|
38 | if (!method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')) { |
|
39 | $this->assertContains('getName', $content); |
|
40 | $this->assertContains("'foo_barbundle_post'", $content); |
|
41 | } else { |
|
42 | $this->assertNotContains('getName', $content); |
|
43 | $this->assertNotContains("'foo_barbundle_post'", $content); |
|
44 | } |
|
45 | } |
|
46 | ||
47 | public function testGenerateMultiSearch() |
|
48 | { |
@@ 23-44 (lines=22) @@ | ||
20 | class PetkoparaFormGeneratorTest extends GeneratorTest |
|
21 | { |
|
22 | ||
23 | public function testGenerate() |
|
24 | { |
|
25 | $this->generateForm(false); |
|
26 | $this->assertTrue(file_exists($this->tmpDir . '/Form/PostType.php')); |
|
27 | $content = file_get_contents($this->tmpDir . '/Form/PostType.php'); |
|
28 | $this->assertContains('->add(\'title\')', $content); |
|
29 | $this->assertContains('->add(\'createdAt\')', $content); |
|
30 | $this->assertContains('->add(\'publishedAt\')', $content); |
|
31 | $this->assertContains('->add(\'updatedAt\')', $content); |
|
32 | $this->assertContains('->add(\'parent\')', $content); |
|
33 | $this->assertContains("'class' => 'FooBundle\Entity\Parent'", $content); |
|
34 | $this->assertContains("'choice_label' => 'name'", $content); |
|
35 | $this->assertContains('class PostType extends AbstractType', $content); |
|
36 | $this->assertContains("'data_class' => 'Foo\BarBundle\Entity\Post'", $content); |
|
37 | if (!method_exists('Symfony\Component\Form\AbstractType', 'getBlockPrefix')) { |
|
38 | $this->assertContains('getName', $content); |
|
39 | $this->assertContains("'foo_barbundle_post'", $content); |
|
40 | } else { |
|
41 | $this->assertNotContains('getName', $content); |
|
42 | $this->assertNotContains("'foo_barbundle_post'", $content); |
|
43 | } |
|
44 | } |
|
45 | ||
46 | /** |
|
47 | * @param boolean $overwrite |