diff options
author | hfuecks <hfuecks@gmail.com> | 2005-10-07 01:38:37 +0200 |
---|---|---|
committer | hfuecks <hfuecks@gmail.com> | 2005-10-07 01:38:37 +0200 |
commit | 07270eb77f4cae99e76668237e246f91de99a0db (patch) | |
tree | 73d82cbc0315ac7291a3e1e4911c0bdb0e79cf6f /test/lib/web.inc.php | |
parent | 91bb5faaff4ff41771606c58f608afd76263b8c7 (diff) | |
download | rpg-07270eb77f4cae99e76668237e246f91de99a0db.tar.gz rpg-07270eb77f4cae99e76668237e246f91de99a0db.tar.bz2 |
test_suite_kickoff
darcs-hash:20051006233837-e96b6-66ac0bf95b0b24fc23921fefaa146e321cebd8c5.gz
Diffstat (limited to 'test/lib/web.inc.php')
-rw-r--r-- | test/lib/web.inc.php | 48 |
1 files changed, 48 insertions, 0 deletions
diff --git a/test/lib/web.inc.php b/test/lib/web.inc.php new file mode 100644 index 000000000..88020bd2a --- /dev/null +++ b/test/lib/web.inc.php @@ -0,0 +1,48 @@ +<?php +/** +* @package WACT_TESTS +* @version $Id: web.inc.php,v 1.6 2005/08/20 09:46:06 pachanga Exp $ +*/ + +SimpleTestOptions::ignore('DWWebTestCase'); + +class DWWebTestCase extends WebTestCase { + + function assertNormalPage() { + $this->assertResponse(array(200)); + $this->assertNoUnwantedPattern('/Warning:/i'); + $this->assertNoUnwantedPattern('/Error:/i'); + $this->assertNoUnwantedPattern('/Fatal error/i'); + } + + function assertWantedLiteral($str) { + $this->assertWantedPattern('/' . preg_quote($str, '/'). '/'); + } + + function assertNoUnWantedLiteral($str) { + $this->assertNoUnWantedPattern('/' . preg_quote($str, '/'). '/'); + } + + function &_fileToPattern($file) { + $file_as_array = file($file); + $pattern = '#^'; + foreach ($file_as_array as $line) { + /* strip trailing newline */ + if ($line[strlen($line) - 1] == "\n") { + $line = substr($line, 0, strlen($line) - 1); + } + $line = preg_quote($line, '#'); + + /* replace paths with wildcard */ + $line = preg_replace("#'/[^']*#", "'.*", $line); + + $pattern .= $line . '\n'; + } + /* strip final newline */ + $pattern = substr($pattern, 0, strlen($pattern) - 2); + $pattern .= '$#i'; + return $pattern; + } + +} +?> |