From 07270eb77f4cae99e76668237e246f91de99a0db Mon Sep 17 00:00:00 2001 From: hfuecks Date: Fri, 7 Oct 2005 01:38:37 +0200 Subject: test_suite_kickoff darcs-hash:20051006233837-e96b6-66ac0bf95b0b24fc23921fefaa146e321cebd8c5.gz --- test/lib/web.inc.php | 48 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 48 insertions(+) create mode 100644 test/lib/web.inc.php (limited to 'test/lib/web.inc.php') 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 @@ +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; + } + +} +?> -- cgit v1.2.3