From 9523dbdc6a0771e54517a67d7a26305775f09b66 Mon Sep 17 00:00:00 2001 From: Dominique Fournier Date: Fri, 23 Oct 2015 08:51:38 +0000 Subject: [PATCH] outputhtml : display the result, not return it ! (and adapt the unit tests accordinally) git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@2372 bf3deb0d-5f1a-0410-827f-c0cc1f45334c --- Tests/outputhtmlTest.php | 12 ++++++------ outputhtml.php | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/Tests/outputhtmlTest.php b/Tests/outputhtmlTest.php index 020214a..d94a8c1 100644 --- a/Tests/outputhtmlTest.php +++ b/Tests/outputhtmlTest.php @@ -11,21 +11,21 @@ class test_outputhtml extends PHPUnit_Framework_TestCase { $output = new outputhtml (); $res = $output->out (""); - $this->assertNotContains ("{content}", $res); + $this->expectOutputRegex ("#\s+#", $res); } public function testlayout2 () { $output = new outputhtml (); $res = $output->out ("data"); - $this->assertContains("data", $res); + $this->expectOutputRegex("#data#"); } public function testlayout3 () { $output = new outputhtml (); $res = $output->out ("data", "title"); - $this->assertContains("data", $res); + $this->expectOutputRegex("#data#"); } public function testlayout4 () @@ -37,7 +37,7 @@ class test_outputhtml extends PHPUnit_Framework_TestCase \n"); $output = new outputhtml (); - print ($output->out ("data", "title", FALSE, FALSE, "Tests/layout.html" )); + $output->out ("data", "title", FALSE, FALSE, "Tests/layout.html" ); } public function testlayout5 () @@ -50,7 +50,7 @@ class test_outputhtml extends PHPUnit_Framework_TestCase \n"); $output = new outputhtml (); $variable = array ("var"=>"VARIABLE"); - print ($output->out ("data", "title", FALSE, FALSE, "Tests/layout.html", - null, $variable)); + $output->out ("data", "title", FALSE, FALSE, "Tests/layout.html", + null, $variable); } } diff --git a/outputhtml.php b/outputhtml.php index 248e8f8..7144a4f 100644 --- a/outputhtml.php +++ b/outputhtml.php @@ -89,7 +89,7 @@ EOT; foreach ($replacement as $key=>$val) $resView = str_replace ($key, $val, $resView); - return $resView; + echo $resView; } /** Get the layout and provide it the variables. The variables will be push in