Passed
Pull Request — master (#2)
by Alex
03:29 queued 37s
created

DateIntervalFactoryFactoryTest   A

Complexity

Total Complexity 2

Size/Duplication

Total Lines 24
Duplicated Lines 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
wmc 2
eloc 6
c 1
b 0
f 0
dl 0
loc 24
rs 10

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testInvokeWillReturnAValidDateIntervalFactoryInstance() 0 9 1
A testImplementsFactoryInterface() 0 5 1
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