LayoutPluginFactoryTest::testCreateService()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 18
Code Lines 11

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 18
rs 9.4285
cc 1
eloc 11
nc 1
nop 0
1
<?php
2
/**
3
 * MtMail - e-mail module for Zend Framework
4
 *
5
 * @link      http://github.com/mtymek/MtMail
6
 * @copyright Copyright (c) 2013-2017 Mateusz Tymek
7
 * @license   BSD 2-Clause
8
 */
9
10
namespace MtMailTest\Factory;
11
12
use MtMail\ComposerPlugin\Layout;
13
use MtMail\Factory\LayoutPluginFactory;
14
use MtMail\Service\ComposerPluginManager;
15
use Zend\ServiceManager\ServiceManager;
16
17
class LayoutPluginFactoryTest extends \PHPUnit\Framework\TestCase
18
{
19
    public function testCreateService()
20
    {
21
        $locator = $this->prophesize(ComposerPluginManager::class);
22
        $locator->get('Configuration')->willReturn(
23
            [
24
                'mt_mail' => [
25
                    'layout' => 'mail/layout.phtml',
26
                ],
27
            ]
28
        );
29
        $serviceManager = $this->prophesize(ServiceManager::class);
30
        $locator->getServiceLocator()->willReturn($serviceManager->reveal());
31
32
        $factory = new LayoutPluginFactory();
33
        $service = $factory($locator->reveal());
34
        $this->assertInstanceOf(Layout::class, $service);
35
        $this->assertEquals('mail/layout.phtml', $service->getLayoutTemplate());
36
    }
37
}
38