Completed
Pull Request — master (#471)
by Timothy
15:13
created

CheckSchemaFactoryTest::testCreateService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace DoctrineORMModuleTest\Diagnostics;
4
5
use Doctrine\ORM\Tools\Console\Command\ValidateSchemaCommand;
6
use DoctrineORMModule\Diagnostics\CheckCommand;
7
use DoctrineORMModule\Diagnostics\CheckSchemaFactory;
8
use Zend\Console\Request;
9
use Zend\ServiceManager\ServiceManager;
10
11
class CheckSchemaFactoryTest extends \PHPUnit_Framework_TestCase
12
{
13
    /** @var Request */
14
    private $request;
15
    
16
    /** @var \PHPUnit_Framework_MockObject_MockObject|ValidateSchemaCommand */
17
    private $command;
18
    
19
    /** @var ServiceManager */
20
    private $serviceLocator;
21
    
22
    /** @var CheckSchemaFactory */
23
    private $sut;
24
25
    protected function setUp()
26
    {
27
        parent::setUp();
28
29
        $this->serviceLocator = new ServiceManager();
30
        
31
        $this->command = $this->getMockBuilder(ValidateSchemaCommand::class)
32
            ->disableOriginalConstructor()
33
            ->getMock();
34
        
35
        $this->request = new Request();
36
        
37
        $this->sut = new CheckSchemaFactory();
38
    }
39
    
40
    public function testCreateService()
41
    {
42
        $this->serviceLocator->setService('doctrine.orm_cmd.validate_schema', $this->command);
43
        $this->serviceLocator->setService('Request', $this->request);
44
        
45
        $actual = $this->sut->createService($this->serviceLocator);
46
        
47
        self::assertInstanceOf(CheckCommand::class, $actual);
48
    }
49
}
50