Completed
Branch master (4042af)
by Aleksandar
02:14
created

CategoryServiceFactoryTest   A

Complexity

Total Complexity 1

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 5

Importance

Changes 1
Bugs 0 Features 0
Metric Value
dl 0
loc 24
rs 10
c 1
b 0
f 0
wmc 1
lcom 1
cbo 5
1
<?php
2
3
declare(strict_types=1);
4
5
namespace Category\Test\Factory\Service;
6
7
class CategoryServiceFactoryTest extends \PHPUnit_Framework_TestCase
8
{
9
    public function testInvokingFactoryShouldReturnExpectedInstance()
10
    {
11
        $categoryFilter = $this->getMockBuilder(\Category\Filter\CategoryFilter::class)
12
            ->getMockForAbstractClass();
13
        $categoryMapper = $this->getMockBuilder(\Category\Mapper\CategoryMapper::class)
14
            ->getMockForAbstractClass();
15
        $container = $this->getMockBuilder(\Interop\Container\ContainerInterface::class)
16
            ->setMethods(['get'])
17
            ->getMockForAbstractClass();
18
        $container->expects(static::at(0))
19
            ->method('get')
20
            ->will(static::returnValue(['upload' => ['public_path' => 'test', 'non_public_path' => 'test']]));
21
        $container->expects(static::at(1))
22
            ->method('get')
23
            ->will(static::returnValue($categoryMapper));
24
        $container->expects(static::at(2))
25
            ->method('get')
26
            ->will(static::returnValue($categoryFilter));
27
        $factory = new \Category\Factory\Service\CategoryServiceFactory();
28
        static::assertInstanceOf(\Category\Service\CategoryService::class, $factory($container));
29
    }
30
}
31