Completed
Pull Request — master (#4)
by Timothy
08:48 queued 02:25
created

CheckOrmInfoFactoryTest::testCreateService()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 9
Code Lines 5

Duplication

Lines 9
Ratio 100 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 9
loc 9
rs 9.6666
cc 1
eloc 5
nc 1
nop 0
1
<?php
2
3
namespace Abacaphiliac\DoctrineORMDiagnosticsModuleTest;
4
5
use Abacaphiliac\DoctrineORMDiagnosticsModule\CheckCommand;
6
use Abacaphiliac\DoctrineORMDiagnosticsModule\CheckOrm\CheckOrmInfoFactory;
7
use Doctrine\ORM\Tools\Console\Command\InfoCommand;
8
use Zend\Console\Request;
9
use Zend\ServiceManager\ServiceManager;
10
11
/**
12
 * @covers \Abacaphiliac\DoctrineORMDiagnosticsModule\CheckOrm\CheckOrmInfoFactory
13
 * @covers \Abacaphiliac\DoctrineORMDiagnosticsModule\AbstractCheckCommandFactory
14
 */
15 View Code Duplication
class CheckOrmInfoFactoryTest extends \PHPUnit_Framework_TestCase
0 ignored issues
show
Duplication introduced by
This class seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
16
{
17
    /** @var Request */
18
    private $request;
19
    
20
    /** @var \PHPUnit_Framework_MockObject_MockObject|InfoCommand */
21
    private $command;
22
    
23
    /** @var ServiceManager */
24
    private $serviceLocator;
25
    
26
    /** @var CheckOrmInfoFactory */
27
    private $sut;
28
29
    protected function setUp()
30
    {
31
        parent::setUp();
32
33
        $this->serviceLocator = new ServiceManager();
34
        
35
        $this->command = $this->getMockBuilder(InfoCommand::class)
36
            ->disableOriginalConstructor()
37
            ->getMock();
38
        
39
        $this->request = new Request();
40
        
41
        $this->sut = new CheckOrmInfoFactory();
42
    }
43
    
44
    public function testCreateService()
45
    {
46
        $this->serviceLocator->setService('doctrine.orm_cmd.info', $this->command);
47
        $this->serviceLocator->setService('Request', $this->request);
48
        
49
        $actual = $this->sut->createService($this->serviceLocator);
50
        
51
        self::assertInstanceOf(CheckCommand::class, $actual);
52
    }
53
}
54