Passed
Pull Request — master (#2)
by Alex
02:35
created

testImplementsFactoryInterface()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 2

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
eloc 2
c 1
b 0
f 0
dl 0
loc 5
rs 10
cc 1
nc 1
nop 0
1
<?php
2
3
declare(strict_types=1);
4
5
namespace ArpTest\LaminasDateTime\Factory;
6
7
use Arp\DateTime\DateIntervalFactory;
8
use Arp\LaminasDateTime\Factory\DateIntervalFactoryFactory;
9
use Arp\LaminasFactory\FactoryInterface;
10
use PHPUnit\Framework\MockObject\MockObject;
11
use PHPUnit\Framework\TestCase;
12
use Psr\Container\ContainerInterface;
13
14
/**
15
 * @covers \Arp\LaminasDateTime\Factory\DateIntervalFactoryFactory
16
 *
17
 * @author  Alex Patterson <[email protected]>
18
 * @package ArpTest\LaminasDateTime\Factory
19
 */
20
final class DateIntervalFactoryFactoryTest extends TestCase
21
{
22
    /**
23
     * Assert the factory implements FactoryInterface
24
     */
25
    public function testImplementsFactoryInterface(): void
26
    {
27
        $factory = new DateIntervalFactoryFactory();
28
29
        $this->assertInstanceOf(FactoryInterface::class, $factory);
30
    }
31
32
    /**
33
     * Assert that the factory will return a valid DateIntervalFactory instance
34
     */
35
    public function testInvokeWillReturnAValidDateIntervalFactoryInstance(): void
36
    {
37
        $factory = new DateIntervalFactoryFactory();
38
39
        /** @var ContainerInterface&MockObject $container */
40
        $container = $this->createMock(ContainerInterface::class);
41
42
        /** @noinspection UnnecessaryAssertionInspection */
43
        $this->assertInstanceOf(DateIntervalFactory::class, $factory($container, DateIntervalFactory::class));
44
    }
45
}
46