Code Duplication    Length = 41-42 lines in 2 locations

src/Graviton/AnalyticsBundle/Tests/Controller/DefaultControllerTest.php 2 locations

@@ 52-92 (lines=41) @@
49
     * Testing basic functionality
50
     * @return void
51
     */
52
    public function testIndex()
53
    {
54
        $client = static::createClient();
55
56
        // Let's get information from the schema
57
        $client->request('GET', '/analytics/schema/app');
58
        $content = $client->getResponse()->getContent();
59
        $schema = json_decode($content);
60
61
        // Check schema
62
        $sampleSchema = json_decode(
63
            '{
64
                    "title": "Application usage",
65
                    "description": "Data use for application access",
66
                    "type": "object",
67
                    "properties": {
68
                      "id": {
69
                        "title": "ID",
70
                        "description": "Unique identifier",
71
                        "type": "string"
72
                      },
73
                      "count": {
74
                        "title": "count",
75
                        "description": "Sum of result",
76
                        "type": "integer"
77
                      }
78
                    },
79
                    "x-params": []
80
                  }'
81
        );
82
        $this->assertEquals($sampleSchema, $schema);
83
84
        // Let's get information from the count
85
        $client->request('GET', '/analytics/app');
86
        $content = $client->getResponse()->getContent();
87
        $data = json_decode($content);
88
89
        // Counter data result of aggregate
90
        $sampleData = json_decode('{"_id":"app-count","count":2}');
91
        $this->assertEquals($sampleData, $data);
92
    }
93
94
    /**
95
     * Testing basic functionality
@@ 116-157 (lines=42) @@
113
     * Testing basic functionality
114
     * @return void
115
     */
116
    public function testCustomerCreateDateFilteringIndex()
117
    {
118
        $client = static::createClient();
119
120
        // Let's get information from the count
121
        $client->request('GET', '/analytics/customer-created-by-date');
122
        $content = $client->getResponse()->getContent();
123
        $data = json_decode($content);
124
125
        // Counter data result of aggregate
126
        $sampleData = json_decode(
127
            '[
128
              {
129
                "_id": "100",
130
                "customerNumber": 1100,
131
                "name": "Acme Corps.",
132
                "created_year": 2014,
133
                "created_month": 7
134
              }
135
            ]'
136
        );
137
        $this->assertEquals($sampleData, $data);
138
139
        // Let's get information from the count, but cached version
140
        $client->request('GET', '/analytics/customer-created-by-date');
141
        $content = $client->getResponse()->getContent();
142
        $data = json_decode($content);
143
144
        // Counter data result of aggregate
145
        $sampleData = json_decode(
146
            '[
147
              {
148
                "_id": "100",
149
                "customerNumber": 1100,
150
                "name": "Acme Corps.",
151
                "created_year": 2014,
152
                "created_month": 7
153
              }
154
            ]'
155
        );
156
        $this->assertEquals($sampleData, $data);
157
    }
158
159
    /**
160
     * test to see if required params are required