File tree Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Expand file tree Collapse file tree 3 files changed +43
-1
lines changed Original file line number Diff line number Diff line change 1212 ],
1313 "autoload" : {
1414 "psr-4" : {
15- "Solid\\ Html\\ " : " src"
15+ "\\ Solid\\ Html\\ " : " src"
1616 }
1717 }
1818}
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Solid \Html ;
4+
5+ class Html
6+ {
7+ public function img (string $ src )
8+ {
9+ return '<img src=" ' . $ src . '"> ' ;
10+ }
11+
12+ public function a (string $ href , string $ anchor )
13+ {
14+ return '<a href=" ' . $ href . '"> ' . $ anchor . '</a> ' ;
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ <?php
2+
3+ namespace Solid \Html ;
4+
5+ class HtmlTest extends \PHPUnit \Framework \TestCase
6+ {
7+
8+ public function testCriarTagImgComSrc ()
9+ {
10+ $ html = new Html ;
11+ $ img = $ html ->img ('img/photo.png ' );
12+
13+ $ this ->assertEquals ('<img src="img/photo.png"> ' , $ img );
14+ }
15+
16+ public function testCriarTagAComImgAncora ()
17+ {
18+ $ html = new Html ;
19+ $ img = $ html ->img ('img/photo.png ' );
20+
21+ $ a = $ html ->a ('http://www.example.com.br ' , $ img );
22+
23+ $ this ->assertEquals ('<a href="http://www.example.com.br"><img src="img/photo.png"></a> ' , $ a );
24+ }
25+
26+ }
You can’t perform that action at this time.
0 commit comments