testScriptAndTranslationCombinedRetrieval()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 21

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
dl 0
loc 21
rs 9.584
c 0
b 0
f 0
cc 1
nc 1
nop 0
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
}