CreateMethodTest::testGenerateAllowLinkerTracker()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 12

Duplication

Lines 12
Ratio 100 %

Importance

Changes 0
Metric Value
dl 12
loc 12
rs 9.8666
c 0
b 0
f 0
cc 1
nc 1
nop 0
1
<?php
2
3
namespace ByTIC\GoogleAnalytics\Tests\Renderer\Script\AnalyticsJs;
4
5
use ByTIC\GoogleAnalytics\Tests\AbstractTest;
6
use ByTIC\GoogleAnalytics\Tracking\Data\Tracker;
7
use ByTIC\GoogleAnalytics\Tracking\Renderer\Script\AnalyticsJs\CreateCommand;
8
9
/**
10
 * Class CreateMethodTest
11
 * @package ByTIC\GoogleAnalytics\Tests\Renderer\Script\AnalyticsJs
12
 */
13
class CreateMethodTest extends AbstractTest
14
{
15
    public function testGenerateEmptyTracker()
16
    {
17
        $tracker = new Tracker();
18
19
        self::assertSame(
20
            "\n" . 'ga("create",null,"auto");',
21
            CreateCommand::generate($tracker)
22
        );
23
    }
24
25 View Code Duplication
    public function testGenerateAliasTracker()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
26
    {
27
        $tracker = new Tracker();
28
        $tracker->setTrackingId('UA-XXXXX-Y');
29
        $tracker->setAlias('myTracker');
30
31
        self::assertSame(
32
            "\n" . 'ga("create","UA-XXXXX-Y","auto","myTracker");',
33
            CreateCommand::generate($tracker)
34
        );
35
    }
36
37 View Code Duplication
    public function testGenerateAllowLinkerTracker()
0 ignored issues
show
Duplication introduced by
This method seems to be duplicated in your project.

Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation.

You can also find more detailed suggestions in the “Code” section of your repository.

Loading history...
38
    {
39
        $tracker = new Tracker();
40
        $tracker->setTrackingId('UA-XXXXX-Y');
41
        $tracker->setAlias('myTracker');
42
        $tracker->setAllowLinker(true);
43
44
        self::assertSame(
45
            "\n" . 'ga("create","UA-XXXXX-Y","auto","myTracker",{"allowLinker":true});',
46
            CreateCommand::generate($tracker)
47
        );
48
    }
49
}
50