These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | namespace Kunstmaan\FormBundle\Tests\Entity; |
||
4 | |||
5 | use Kunstmaan\FormBundle\Entity\AbstractFormPage; |
||
6 | use Kunstmaan\FormBundle\Form\AbstractFormPageAdminType; |
||
7 | use Kunstmaan\NodeBundle\Entity\NodeTranslation; |
||
8 | use Kunstmaan\NodeBundle\Helper\RenderContext; |
||
9 | use PHPUnit\Framework\TestCase; |
||
10 | use Symfony\Component\Routing\RouterInterface; |
||
11 | |||
12 | class AbstractFormPageTest extends TestCase |
||
13 | { |
||
14 | /** |
||
15 | * @var AbstractFormPage |
||
16 | */ |
||
17 | protected $object; |
||
18 | |||
19 | /** |
||
20 | * Sets up the fixture, for example, opens a network connection. |
||
21 | * This method is called before a test is executed. |
||
22 | */ |
||
23 | protected function setUp() |
||
24 | { |
||
25 | $this->object = $this->getMockForAbstractClass('Kunstmaan\FormBundle\Entity\AbstractFormPage'); |
||
0 ignored issues
–
show
|
|||
26 | } |
||
27 | |||
28 | public function testSetGetThanks() |
||
29 | { |
||
30 | $object = $this->object; |
||
31 | $value = 'thanks'; |
||
32 | $object->setThanks($value); |
||
33 | $this->assertEquals($value, $object->getThanks()); |
||
34 | } |
||
35 | |||
36 | public function testSetGetSubject() |
||
37 | { |
||
38 | $object = $this->object; |
||
39 | $value = 'some subject'; |
||
40 | $object->setSubject($value); |
||
41 | $this->assertEquals($value, $object->getSubject()); |
||
42 | } |
||
43 | |||
44 | public function testSetGetToEmail() |
||
45 | { |
||
46 | $object = $this->object; |
||
47 | $value = '[email protected]'; |
||
48 | $object->setToEmail($value); |
||
49 | $this->assertEquals($value, $object->getToEmail()); |
||
50 | } |
||
51 | |||
52 | public function testSetGetFromEmail() |
||
53 | { |
||
54 | $object = $this->object; |
||
55 | $value = '[email protected]'; |
||
56 | $object->setFromEmail($value); |
||
57 | $this->assertEquals($value, $object->getFromEmail()); |
||
58 | } |
||
59 | |||
60 | public function testGetDefaultAdminType() |
||
61 | { |
||
62 | $this->assertEquals(AbstractFormPageAdminType::class, $this->object->getDefaultAdminType()); |
||
63 | } |
||
64 | |||
65 | public function testGetFormElementsContext() |
||
66 | { |
||
67 | $stringValue = $this->object->getFormElementsContext(); |
||
68 | $this->assertNotNull($stringValue); |
||
69 | $this->assertTrue(is_string($stringValue)); |
||
70 | } |
||
71 | |||
72 | public function testGetControllerAction() |
||
73 | { |
||
74 | $action = $this->object->getControllerAction(); |
||
75 | $this->assertEquals('KunstmaanFormBundle:AbstractFormPage:service', $action); |
||
76 | } |
||
77 | |||
78 | public function testGenerateThankYouUrl() |
||
79 | { |
||
80 | $obj = $this->object; |
||
81 | |||
82 | $router = $this->getMockBuilder(RouterInterface::class) |
||
83 | ->disableOriginalConstructor() |
||
84 | ->getMock(); |
||
85 | |||
86 | $router->expects($this->any()) |
||
87 | ->method('generate') |
||
88 | ->will($this->returnValue('https://nasa.gov')); |
||
89 | |||
90 | $context = new RenderContext(); |
||
91 | $trans = new NodeTranslation(); |
||
92 | $trans->setLang('en'); |
||
93 | $context['nodetranslation'] = $trans; |
||
94 | $context['slug'] = 'snail-soup-with-celery'; |
||
95 | |||
96 | $action = $obj->generateThankYouUrl($router, $context); |
||
97 | $this->assertEquals('https://nasa.gov', $action); |
||
98 | } |
||
99 | } |
||
100 |
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.
Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..