for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
class LocalizationScriptTest extends TestCase
{
public function testScriptRetrieval()
$response = $this->call('GET', '/js-localization/localization.js');
$this->assertTrue($response->isOk());
$content = $response->getContent();
// Test for JS content
$this->assertRegExp('/^!?\(?function\(.*\);/', $content);
}
public function testScriptAndTranslationCombinedRetrieval()
$response = $this->call('GET', '/js-localization/all.js');
// Test for Lang.addMessages()
$addMessagesRegex = '/Lang\.addMessages\( (\{.*?\}) \);/x';
$this->assertRegExp($addMessagesRegex, $content);
// Test for Config.addConfig()
$addConfigRegex = '/Config\.addConfig\( (\{.*?\}) \);/x';
$this->assertRegExp($addConfigRegex, $content);