Skip to content

Commit de95127

Browse files
author
Dmytro Vilchynskyi
committed
MAGETWO-33407: Cover MAGETWO-31855 changes by static tests
- add static test - fixed found errors due to added test
1 parent e297781 commit de95127

File tree

2 files changed

+28
-1
lines changed

2 files changed

+28
-1
lines changed

app/code/Magento/GoogleAdwords/view/frontend/templates/code.phtml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@
1818
var google_conversion_value = <?php echo $this->getHelper()->getConversionValue() ?>;
1919
/* ]]> */
2020
</script>
21-
<script type="text/javascript" src="<?php echo $this->getHelper()->getConversionJsSrc()?>"></script>
21+
<script src="<?php echo $this->getHelper()->getConversionJsSrc()?>"></script>
2222
<noscript>
2323
<div style="display:inline;">
2424
<img height="1" width="1" style="border-style:none;" alt=""

dev/tests/static/testsuite/Magento/Test/Legacy/PhtmlTemplateTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,31 @@ function ($file) {
3535
\Magento\Framework\Test\Utility\Files::init()->getPhtmlFiles()
3636
);
3737
}
38+
39+
public function testObsoleteJavascriptAttributeType()
40+
{
41+
$invoker = new \Magento\Framework\Test\Utility\AggregateInvoker($this);
42+
$invoker(
43+
/**
44+
* Test usage of protected and private methods and variables in template
45+
*
46+
* According to naming convention (B5.8, B6.2) all class members
47+
* in protected or private scope should be prefixed with underscore.
48+
* Member variables declared "public" should never start with an underscore.
49+
* Access to protected and private members of Block class is obsolete in phtml templates
50+
* since introduction of multiple template engines support
51+
*
52+
* @param string $file
53+
*/
54+
function ($file) {
55+
$this->assertNotRegexp(
56+
'/type="text\/javascript"/',
57+
file_get_contents($file),
58+
'Please do not use "text/javascript" type attribute due to HTML5 standards.' .
59+
' For more details please go to "http://www.w3.org/TR/html5/scripting-1.html".'
60+
);
61+
},
62+
\Magento\Framework\Test\Utility\Files::init()->getPhtmlFiles()
63+
);
64+
}
3865
}

0 commit comments

Comments
 (0)