LocalizationScriptTest   A
last analyzed

Complexity

Total Complexity 2

Size/Duplication

Total Lines 36
Duplicated Lines 0 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

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

2 Methods

Rating   Name   Duplication   Size   Complexity  
A testScriptRetrieval() 0 11 1
A testScriptAndTranslationCombinedRetrieval() 0 21 1
1
<?php
2
3
class LocalizationScriptTest extends TestCase
4
{
5
    public function testScriptRetrieval()
6
    {
7
        $response = $this->call('GET', '/js-localization/localization.js');
8
9
        $this->assertTrue($response->isOk());
10
        $content = $response->getContent();
11
        
12
        // Test for JS content
13
        
14
        $this->assertRegExp('/^!?\(?function\(.*\);/', $content);
15
    }
16
    
17
    public function testScriptAndTranslationCombinedRetrieval()
18
    {
19
        $response = $this->call('GET', '/js-localization/all.js');
20
21
        $this->assertTrue($response->isOk());
22
        $content = $response->getContent();
23
24
        // Test for JS content
25
26
        $this->assertRegExp('/^!?\(?function\(.*\);/', $content);
27
28
        // Test for Lang.addMessages()
29
30
        $addMessagesRegex = '/Lang\.addMessages\( (\{.*?\}) \);/x';
31
        $this->assertRegExp($addMessagesRegex, $content);
32
        
33
        // Test for Config.addConfig()
34
35
        $addConfigRegex = '/Config\.addConfig\( (\{.*?\}) \);/x';
36
        $this->assertRegExp($addConfigRegex, $content);
37
    }
38
}