FormAnnotationBuilderFactoryTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 5

Importance

Changes 0
Metric Value
wmc 1
lcom 0
cbo 5
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testFormElementManagerGetsInjected() 0 19 1
1
<?php
2
3
namespace DoctrineORMModuleTest\Service;
4
5
use DoctrineORMModule\Service\FormAnnotationBuilderFactory;
6
use PHPUnit\Framework\TestCase;
7
use Laminas\ServiceManager\ServiceManager;
8
9
/**
10
 * Tests for {@see \DoctrineORMModule\Service\FormAnnotationBuilderFactory}
11
 *
12
 * @covers \DoctrineORMModule\Service\FormAnnotationBuilderFactory
13
 */
14
class FormAnnotationBuilderFactoryTest extends TestCase
15
{
16
    /**
17
     * @group #352
18
     */
19
    public function testFormElementManagerGetsInjected()
20
    {
21
        $entityManager      = $this->getMockBuilder(\Doctrine\ORM\EntityManager::class)
0 ignored issues
show
Bug introduced by
The method disableOriginalConstructor cannot be called on $this->getMockBuilder(\D...M\EntityManager::class) (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
22
            ->disableOriginalConstructor()
23
            ->getMock();
24
        $formElementManager = $this->getMockBuilder(\Laminas\Form\FormElementManager::class)
0 ignored issues
show
Bug introduced by
The method disableOriginalConstructor cannot be called on $this->getMockBuilder(\L...mElementManager::class) (of type null).

Methods can only be called on objects. This check looks for methods being called on variables that have been inferred to never be objects.

Loading history...
25
            ->disableOriginalConstructor()
26
            ->getMock();
27
28
        $serviceManager = new ServiceManager();
29
30
        $serviceManager->setService('doctrine.entitymanager.test', $entityManager);
31
        $serviceManager->setService('FormElementManager', $formElementManager);
32
33
        $annotationBuilderFactory = new FormAnnotationBuilderFactory('test');
34
        $annotationBuilder = $annotationBuilderFactory->createService($serviceManager);
35
36
        $this->assertSame($formElementManager, $annotationBuilder->getFormFactory()->getFormElementManager());
0 ignored issues
show
Bug introduced by
The method assertSame() does not seem to exist on object<DoctrineORMModule...tionBuilderFactoryTest>.

This check looks for calls to methods that do not seem to exist on a given type. It looks for the method on the type itself as well as in inherited classes or implemented interfaces.

This is most likely a typographical error or the method has been renamed.

Loading history...
37
    }
38
}
39