ConfigProviderTest   A
last analyzed

Complexity

Total Complexity 1

Size/Duplication

Total Lines 25
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 2

Importance

Changes 0
Metric Value
wmc 1
lcom 1
cbo 2
dl 0
loc 25
rs 10
c 0
b 0
f 0

1 Method

Rating   Name   Duplication   Size   Complexity  
A testInvokeHasCorrectKeys() 0 22 1
1
<?php
2
3
declare(strict_types=1);
4
5
namespace DoctrineModuleTest;
6
7
use DoctrineModule\ConfigProvider;
8
use PHPUnit\Framework\TestCase;
9
use function serialize;
10
use function unserialize;
11
12
/**
13
 * Tests used to ensure ConfigProvider operates as expected
14
 *
15
 * @link    http://www.doctrine-project.org/
16
 */
17
class ConfigProviderTest extends TestCase
18
{
19
    public function testInvokeHasCorrectKeys() : void
20
    {
21
        $config = (new ConfigProvider())->__invoke();
22
23
        self::assertIsArray($config);
24
25
        self::assertArrayHasKey('doctrine', $config, 'Expected config to have "doctrine" array key');
26
        self::assertArrayHasKey(
27
            'doctrine_factories',
28
            $config,
29
            'Expected config to have "doctrine_factories" array key'
30
        );
31
        self::assertArrayHasKey('dependencies', $config, 'Expected config to have "dependencies" array key');
32
        self::assertArrayHasKey('controllers', $config, 'Expected config to have "controllers" array key');
33
        self::assertArrayHasKey('route_manager', $config, 'Expected config to have "route_manager" array key');
34
        self::assertArrayHasKey('console', $config, 'Expected config to have "console" array key');
35
36
        // Config Provider should not have service_manager key; should only exist in ZF Module
37
        self::assertArrayNotHasKey('service_manager', $config, 'Config should not have "service_manager" array key');
38
39
        self::assertSame($config, unserialize(serialize($config)));
40
    }
41
}
42