function CoderReviewUpgrade7xTest::testJavascript7x in Coder 7
Same name and namespace in other branches
- 7.2 coder_review/tests/coder_review_7x.test \CoderReviewUpgrade7xTest::testJavascript7x()
File
- coder_review/tests/coder_review_7x.test, line 381
Class
- CoderReviewUpgrade7xTest
Code
function testJavascript7x() {
$this
->assertCoderReviewFail(" drupal_add_js(\$data, 'module');");
$this
->assertCoderReviewPass(" drupal_add_js(\$data, 'file');");
$this
->assertCoderReviewFail(" drupal_add_js(\$data, 'file', 'header');");
$this
->assertCoderReviewFail(" drupal_add_js(\$data, 'file', \$header, \$defer);");
$this
->assertCoderReviewPass(" drupal_add_js(\$jquery_plugin, array('weight' => JS_LIBRARY));");
$this
->assertCoderReviewPass(" function mytheme_preprocess_page(&\$variables) {\n \$scripts = \$variables['myscripts'];\n}");
$this
->assertCoderReviewFail(" function mytheme_preprocess_page(&\$variables) {\n \$scripts = \$variables['scripts'];\n}");
$this
->assertCoderReviewPass(' drupal_add_html_head("foo");');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script type="text/javascript" src="foo.js"/>\');');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script src="foo.js">\');');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script src="http://example.com/foo.js">\');');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script src="/files/foo.js">\');');
$this
->assertCoderReviewFail(' drupal_add_html_head(\'<script src="http://example123-ab_c.com.js">\');');
}