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\NodeBundle\Tests\Entity; |
||
4 | |||
5 | use Kunstmaan\NodeBundle\Entity\AbstractControllerAction; |
||
6 | use Kunstmaan\NodeBundle\Entity\HasNodeInterface; |
||
7 | use Kunstmaan\NodeBundle\Form\ControllerActionAdminType; |
||
8 | use PHPUnit\Framework\TestCase; |
||
9 | |||
10 | class Action extends AbstractControllerAction |
||
11 | { |
||
12 | public function getPossibleChildTypes() |
||
13 | { |
||
14 | return []; |
||
15 | } |
||
16 | |||
17 | public function isStructureNode() |
||
18 | { |
||
19 | return false; |
||
20 | } |
||
21 | } |
||
22 | |||
23 | class AbstractControllerActionTest extends TestCase |
||
0 ignored issues
–
show
|
|||
24 | { |
||
25 | public function testGetSet() |
||
26 | { |
||
27 | $action = new Action(); |
||
28 | $action->setId(5); |
||
29 | $action->setTitle('Global Economic Meltdown - The Movie'); |
||
30 | /** @var HasNodeInterface $entity */ |
||
31 | $entity = $this->createMock(HasNodeInterface::class); |
||
32 | $action->setParent($entity); |
||
33 | |||
34 | $this->assertEquals(5, $action->getId()); |
||
35 | $this->assertEquals('Global Economic Meltdown - The Movie', $action->getTitle()); |
||
36 | $this->assertInstanceOf(\get_class($entity), $action->getParent()); |
||
37 | $this->assertEquals(ControllerActionAdminType::class, $action->getDefaultAdminType()); |
||
38 | } |
||
39 | } |
||
40 |
Having each class in a dedicated file usually plays nice with PSR autoloaders and is therefore a well established practice. If you use other autoloaders, you might not want to follow this rule.