1 | <?php |
||
11 | class HappyrGoogleAnalyticsExtensionTest extends AbstractExtensionTestCase |
||
12 | { |
||
13 | protected function getMinimalConfiguration() |
||
14 | { |
||
15 | return ['tracking_id' => 'id']; |
||
16 | } |
||
17 | |||
18 | protected function getContainerExtensions() |
||
19 | { |
||
20 | return [ |
||
21 | new HappyrGoogleAnalyticsExtension(), |
||
22 | ]; |
||
23 | } |
||
24 | |||
25 | public function testTracker() |
||
26 | { |
||
27 | $this->load(); |
||
28 | $this->assertContainerBuilderHasService('happyr.google_analytics.tracker', Tracker::class); |
||
29 | $this->assertContainerBuilderHasServiceDefinitionWithArgument('happyr.google_analytics.tracker', 0, new Reference('happyr.google_analytics.http.client')); |
||
30 | } |
||
31 | |||
32 | public function testTrackerDisabled() |
||
33 | { |
||
34 | $this->load(['enabled' => false]); |
||
35 | $this->assertContainerBuilderHasService('happyr.google_analytics.tracker', Tracker::class); |
||
36 | $this->assertContainerBuilderHasServiceDefinitionWithArgument('happyr.google_analytics.tracker', 0, new Reference('happyr.google_analytics.http.void')); |
||
37 | } |
||
38 | |||
39 | public function testFetcher() |
||
40 | { |
||
41 | $this->load(['fetching' => ['client_service' => 'foo']]); |
||
42 | $this->assertContainerBuilderHasService('happyr.google_analytics.data_fetcher', DataFetcher::class); |
||
43 | $this->assertContainerBuilderHasServiceDefinitionWithArgument('happyr.google_analytics.data_fetcher', 1, new Reference('foo')); |
||
44 | } |
||
45 | |||
46 | public function testFetcherDisabled() |
||
47 | { |
||
48 | $this->load(); |
||
49 | $this->assertContainerBuilderNotHasService('happyr.google_analytics.data_fetcher'); |
||
50 | } |
||
51 | } |
||
52 |