TagManagerTwigSpec   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 21
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A it_is_initializable() 0 4 1
A it_renders_tag_manager_container() 0 13 1
1
<?php
2
3
/*
4
 * This file is part of the WPFoundation library.
5
 *
6
 * Copyright (c) 2015-present LIN3S <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
namespace spec\LIN3S\WPFoundation\Twig;
13
14
use LIN3S\WordPressPhpSpecBridge\ObjectBehavior;
15
16
/**
17
 * Spec of TagManagerTwig class.
18
 *
19
 * @author Gorka Laucirica <[email protected]>
20
 */
21
class TagManagerTwigSpec extends ObjectBehavior
22
{
23
    function it_is_initializable()
24
    {
25
        $this->shouldHaveType('LIN3S\WPFoundation\Twig\TagManagerTwig');
26
    }
27
28
    function it_renders_tag_manager_container()
29
    {
30
        $this->tagManagerFunction('GTM-XXXXXX')->shouldReturn(<<<'EOT'
31
<noscript><iframe src="//www.googletagmanager.com/ns.html?id=GTM-XXXXXX"
32
height="0" width="0" style="display:none;visibility:hidden"></iframe></noscript>
33
<script>(function(w,d,s,l,i){w[l]=w[l]||[];w[l].push({'gtm.start':
34
new Date().getTime(),event:'gtm.js'});var f=d.getElementsByTagName(s)[0],
35
j=d.createElement(s),dl=l!='dataLayer'?'&l='+l:'';j.async=true;j.src=
36
'//www.googletagmanager.com/gtm.js?id='+i+dl;f.parentNode.insertBefore(j,f);
37
})(window,document,'script','dataLayer','GTM-XXXXXX');</script>
38
EOT
39
        );
40
    }
41
}
42