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
This commit is contained in:
2015-10-23 08:51:38 +00:00
parent 34322f8540
commit 9523dbdc6a
2 changed files with 7 additions and 7 deletions

View File

@@ -11,21 +11,21 @@ class test_outputhtml extends PHPUnit_Framework_TestCase
{ {
$output = new outputhtml (); $output = new outputhtml ();
$res = $output->out (""); $res = $output->out ("");
$this->assertNotContains ("{content}", $res); $this->expectOutputRegex ("#<body>\s+</body>#", $res);
} }
public function testlayout2 () public function testlayout2 ()
{ {
$output = new outputhtml (); $output = new outputhtml ();
$res = $output->out ("data"); $res = $output->out ("data");
$this->assertContains("data", $res); $this->expectOutputRegex("#data#");
} }
public function testlayout3 () public function testlayout3 ()
{ {
$output = new outputhtml (); $output = new outputhtml ();
$res = $output->out ("data", "title"); $res = $output->out ("data", "title");
$this->assertContains("data", $res); $this->expectOutputRegex("#data#");
} }
public function testlayout4 () public function testlayout4 ()
@@ -37,7 +37,7 @@ class test_outputhtml extends PHPUnit_Framework_TestCase
</body> </body>
</html>\n"); </html>\n");
$output = new outputhtml (); $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 () public function testlayout5 ()
@@ -50,7 +50,7 @@ class test_outputhtml extends PHPUnit_Framework_TestCase
</html>\n"); </html>\n");
$output = new outputhtml (); $output = new outputhtml ();
$variable = array ("var"=>"VARIABLE"); $variable = array ("var"=>"VARIABLE");
print ($output->out ("data", "title", FALSE, FALSE, "Tests/layout.html", $output->out ("data", "title", FALSE, FALSE, "Tests/layout.html",
null, $variable)); null, $variable);
} }
} }

View File

@@ -89,7 +89,7 @@ EOT;
foreach ($replacement as $key=>$val) foreach ($replacement as $key=>$val)
$resView = str_replace ($key, $val, $resView); $resView = str_replace ($key, $val, $resView);
return $resView; echo $resView;
} }
/** Get the layout and provide it the variables. The variables will be push in /** Get the layout and provide it the variables. The variables will be push in