CheckSchemaFactoryTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 39
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 1
Metric Value
wmc 2
c 1
b 0
f 1
lcom 1
cbo 5
dl 0
loc 39
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A setUp() 0 14 1
A testCreateService() 0 9 1
1
<?php
2
3
namespace Abacaphiliac\DoctrineORMDiagnosticsModuleTest;
4
5
use Abacaphiliac\DoctrineORMDiagnosticsModule\CheckCommand;
6
use Abacaphiliac\DoctrineORMDiagnosticsModule\CheckSchemaFactory;
7
use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand;
8
use Zend\Console\Request;
9
use Zend\ServiceManager\ServiceManager;
10
11
/**
12
 * @covers \Abacaphiliac\DoctrineORMDiagnosticsModule\CheckSchemaFactory
13
 */
14
class CheckSchemaFactoryTest extends \PHPUnit_Framework_TestCase
15
{
16
    /** @var Request */
17
    private $request;
18
    
19
    /** @var \PHPUnit_Framework_MockObject_MockObject|ValidateSchemaCommand */
20
    private $command;
21
    
22
    /** @var ServiceManager */
23
    private $serviceLocator;
24
    
25
    /** @var CheckSchemaFactory */
26
    private $sut;
27
28
    protected function setUp()
29
    {
30
        parent::setUp();
31
32
        $this->serviceLocator = new ServiceManager();
33
        
34
        $this->command = $this->getMockBuilder(ValidateSchemaCommand::class)
35
            ->disableOriginalConstructor()
36
            ->getMock();
37
        
38
        $this->request = new Request();
39
        
40
        $this->sut = new CheckSchemaFactory();
41
    }
42
    
43
    public function testCreateService()
44
    {
45
        $this->serviceLocator->setService('doctrine.orm_cmd.validate_schema', $this->command);
46
        $this->serviceLocator->setService('Request', $this->request);
47
        
48
        $actual = $this->sut->createService($this->serviceLocator);
49
        
50
        self::assertInstanceOf(CheckCommand::class, $actual);
51
    }
52
}
53