Check web page content
The previous test only checked if a page was returned but not the content of the page so we add another assertion that checks if a given string can be found in the text of the web page.
examples/php/simpletest/web02.php
<?php require_once(dirname(__FILE__) . '/../../../tools/simpletest/autorun.php'); require_once(dirname(__FILE__) . '/../../../tools/simpletest/web_tester.php'); class TestOfCalculator extends WebTestCase { function testBasicCalc() { $url = 'http://localhost:8081/php/calc/basic_calc.php'; $this->assertTrue($this->get($url)); $this->assertText('Basic Calculator'); } } ?>