1 | <?php |
||
9 | class OptionsConfigFactoryTest extends TestCase |
||
10 | { |
||
11 | public function testInvoke() |
||
12 | { |
||
13 | $config = [ |
||
14 | 'facile' => [ |
||
15 | 'zf_link_headers_module' => [ |
||
16 | 'stylesheet_enabled' => true, |
||
17 | 'stylesheet_mode' => 'preload', |
||
18 | 'http2_push_enabled' => false, |
||
19 | ], |
||
20 | ], |
||
21 | ]; |
||
22 | |||
23 | $container = $this->prophesize(ContainerInterface::class); |
||
24 | |||
25 | $container->get('config')->willReturn($config); |
||
26 | |||
27 | $factory = new OptionsConfigFactory(); |
||
28 | |||
29 | $result = $factory($container->reveal()); |
||
30 | |||
31 | $this->assertInstanceOf(Options::class, $result); |
||
32 | $this->assertSame('preload', $result->getStylesheetMode()); |
||
33 | $this->assertSame(true, $result->isStylesheetEnabled()); |
||
34 | $this->assertSame(false, $result->isHttp2PushEnabled()); |
||
35 | } |
||
36 | |||
37 | public function testInvokeWithDifferentParams() |
||
38 | { |
||
39 | $config = [ |
||
40 | 'facile' => [ |
||
41 | 'zf_link_headers_module' => [ |
||
42 | 'stylesheet_enabled' => false, |
||
43 | 'stylesheet_mode' => 'prefetch', |
||
44 | 'http2_push_enabled' => true, |
||
45 | ], |
||
46 | ], |
||
47 | ]; |
||
48 | |||
49 | $container = $this->prophesize(ContainerInterface::class); |
||
50 | |||
51 | $container->get('config')->willReturn($config); |
||
52 | |||
53 | $factory = new OptionsConfigFactory(); |
||
54 | |||
55 | $result = $factory($container->reveal()); |
||
56 | |||
57 | $this->assertInstanceOf(Options::class, $result); |
||
58 | $this->assertSame('prefetch', $result->getStylesheetMode()); |
||
59 | $this->assertSame(false, $result->isStylesheetEnabled()); |
||
60 | $this->assertSame(true, $result->isHttp2PushEnabled()); |
||
61 | } |
||
62 | } |
||
63 |