DateIntervalFactoryFactoryTest   A
last analyzed

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
final class DateIntervalFactoryFactoryTest extends TestCase
18
{
19
    /**
20
     * Assert the factory implements FactoryInterface
21
     */
22
    public function testImplementsFactoryInterface(): void
23
    {
24
        $factory = new DateIntervalFactoryFactory();
25
26
        $this->assertInstanceOf(FactoryInterface::class, $factory);
27
    }
28
29
    /**
30
     * Assert that the factory will return a valid DateIntervalFactory instance
31
     */
32
    public function testInvokeWillReturnAValidDateIntervalFactoryInstance(): void
33
    {
34
        $factory = new DateIntervalFactoryFactory();
35
36
        /** @var ContainerInterface&MockObject $container */
37
        $container = $this->createMock(ContainerInterface::class);
38
39
        /** @noinspection UnnecessaryAssertionInspection */
40
        $this->assertInstanceOf(DateIntervalFactory::class, $factory($container, DateIntervalFactory::class));
41
    }
42
}
43