File tree Expand file tree Collapse file tree 4 files changed +100
-0
lines changed Expand file tree Collapse file tree 4 files changed +100
-0
lines changed Original file line number Diff line number Diff line change 1+ language : php
2+
3+ php :
4+ - 7.0
5+ - 7.1
6+
7+ before_install :
8+ - composer self-update
9+ - composer clear-cache
10+
11+ install :
12+ - travis_retry composer update --no-interaction --no-suggest --prefer-source --optimize-autoloader
13+
14+ script :
15+ - phpunit
16+
17+ after_success :
18+ - bash <(curl -s https://codecov.io/bash)
19+
20+ notifications :
21+ - email : false
Original file line number Diff line number Diff line change 1818 "Html5Gen\\ " : " src/Html5Gen"
1919 }
2020 },
21+ "autoload-dev" : {
22+ "psr-4" : {
23+ "Html5Gen\\ Tests\\ " : " tests"
24+ }
25+ },
2126 "require" : {
2227 "php" : " >=5.5"
28+ },
29+ "require-dev" : {
30+ "php" : " ^7.0" ,
31+ "phpunit/phpunit" : " ^6.0"
2332 }
2433}
Original file line number Diff line number Diff line change 1+ <?xml version =" 1.0" encoding =" UTF-8" ?>
2+ <phpunit bootstrap =" vendor/autoload.php" >
3+ <testsuites >
4+ <testsuite name =" Test" >
5+ <directory >tests</directory >
6+ </testsuite >
7+ </testsuites >
8+ <filter >
9+ <whitelist processUncoveredFilesFromWhitelist =" true" >
10+ <directory suffix =" .php" >src</directory >
11+ </whitelist >
12+ </filter >
13+ <logging >
14+ <log type =" coverage-clover" target =" coverage.xml" />
15+ </logging >
16+ </phpunit >
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Html5Gen \Tests ;
4+
5+ use Html5Gen \Html5Gen as H ;
6+ use PHPUnit \Framework \TestCase ;
7+
8+ class Html5GenTest extends TestCase
9+ {
10+ public function testHtmlDocument ()
11+ {
12+ $ html =
13+ H::html ([], function () {
14+ H::head ();
15+ H::body ();
16+ });
17+
18+ $ expect = <<<HTML
19+ <!DOCTYPE html>
20+ <html>
21+ <head></head>
22+ <body></body>
23+ </html>
24+
25+ HTML ;
26+
27+ $ this ->assertEquals ($ expect , $ html );
28+ }
29+
30+ public function testScript ()
31+ {
32+
33+ $ html =
34+ H::html ([], function () {
35+ H::head ([]);
36+ H::body ([], function () {
37+ H::script ([], function () {
38+ yield 'alert(1); ' ;
39+ });
40+ });
41+ });
42+
43+ $ expect = <<<HTML
44+ <!DOCTYPE html>
45+ <html>
46+ <head></head>
47+ <body><script>alert(1);</script></body>
48+ </html>
49+
50+ HTML ;
51+
52+ $ this ->assertEquals ($ expect , $ html );
53+ }
54+ }
You can’t perform that action at this time.
0 commit comments