public function JsTestWebTestCase::testBase in JS Callback Handler 6
Same name and namespace in other branches
- 7 tests/js_test.test \JsTestWebTestCase::testBase()
Test basic JS callbacks.
File
- tests/
js_test.test, line 30 - Testing for the bam template module
Class
- JsTestWebTestCase
- @file Testing for the bam template module
Code
public function testBase() {
// Via clean url (rewrite).
$out = $this
->drupalGet('js/js_test/test_basic');
$out = (array) json_decode($out);
$this
->assertEqual($out['filename'], 'js.php', 'Call was routed through js.php.');
$this
->assertEqual($out['response'], 'ok', 'The response to the basic test was ok.');
// Test Page arguments.
$out = $this
->drupalGet('js/js_test/test_arguments/value1/value2');
$out = (array) json_decode($out);
$this
->assertEqual($out['response']->argument_1, 'value1', 'Page argument 1 should be value1 and is ' . $out['response']->argument_1 . '.');
$this
->assertEqual($out['response']->argument_2, 'value2', 'Page argument 2 should be value2 and is ' . $out['response']->argument_2 . '.');
// Test seperate file.
$out = $this
->drupalGet('js/js_test/test_file');
$out = (array) json_decode($out);
$this
->assertEqual($out['response'], 'ok', 'The response to the file test was ok.');
}