From d8852cfabe07ca0bf69ab1a4b6ca7a80cd25fb04 Mon Sep 17 00:00:00 2001 From: Jani Taskinen Date: Sun, 2 Aug 2009 01:48:27 +0000 Subject: [PATCH] - More and more missing svn:ignore entries. --- ext/sybase_ct/tests/index.php | 216 ---------------------------------- 1 file changed, 216 deletions(-) delete mode 100644 ext/sybase_ct/tests/index.php diff --git a/ext/sybase_ct/tests/index.php b/ext/sybase_ct/tests/index.php deleted file mode 100644 index 47202efa3b..0000000000 --- a/ext/sybase_ct/tests/index.php +++ /dev/null @@ -1,216 +0,0 @@ -expected= $expected; - } - - function matches($output) { } - } - // }}} - - // {{{ class PHPTRegexExpectancy - // Expectancy class for regular expressions - class PHPTRegexExpectancy extends PHPTExpectancy { - - function matches($output) { - return preg_match('°^'.strtr(preg_quote(rtrim($this->expected), '°'), array( - '%s' => '(.+)', - '%d' => '([0-9]+)' - )).'°', $output); - } - } - // }}} - - // {{{ class PHPTTest - // Represents a single .phpt-style test - class PHPTTest { - var - $name = '', - $description = '', - $skipif = '', - $code = '', - $expectancy = NULL, - $output = ''; - - function &fromFile($filename) { - $fd= fopen($filename, 'r'); - - $sections= array(); - $current= NULL; - while (!feof($fd)) { - $line= fgets($fd, 0xFFFF); - if (1 == sscanf($line, '--%[^-]--', $section)) { - $sections[$section]= ''; - $current= $section; - continue; - } - $sections[$current].= $line; - } - fclose($fd); - - // Create instance from read data and return it - $t= &new PHPTTest(); { - $t->name= substr(realpath($filename), 0, -1); - $t->description= rtrim($sections['TEST']); - $t->skipif= $sections['SKIPIF']; - $t->code= $sections['FILE']; - - if (isset($sections['EXPECTF'])) { - $t->expectancy= &new PHPTRegexExpectancy($sections['EXPECTF']); - } else { - // XXX TBI XXX - } - } - return $t; - } - - function onError($errno, $errstr, $errfile, $errline) { - static $names= array( - E_NOTICE => 'Notice', - E_WARNING => 'Warning' - ); - - if (!(error_reporting() & $errno)) return; - printf( - "\n%s: %s in %s on line %d\n", - $names[$errno], - $errstr, - strstr($errfile, 'eval()\'d code') ? $this->name : $errfile, - $errline - ); - } - - function run() { - - // Precondition check - will die if test needs to be skipped - eval('?>'.$this->skipif); - - set_error_handler(array(&$this, 'onError')); { - error_reporting(E_ALL); - - ob_start(); - eval('?>'.$this->code); - $this->output= rtrim(ob_get_contents()); - ob_end_clean(); - } restore_error_handler(); - - return $this->expectancy->matches($this->output); - } - } - // }}} - - // {{{ main - if (isset($_GET['phpinfo'])) { - phpinfo((int)$_GET['phpinfo']); - - echo 'Home'; - exit(); - } - - echo <<<__ - - - PHPT Test - - - -__; - - $test= basename($_SERVER['QUERY_STRING']); - if ($test && file_exists($test)) { - $t= &PHPTTest::fromFile($test); - echo '

'.basename($t->name), ': ', $t->description.'

'; - echo 'Back to test suite'; - flush(); - - // Run the test - $result= $t->run(); - - // Evaluate results - if ($result) { - echo '

Passed

'; - } else { - echo '

Failed


'; - - echo '

Actual output

'; - echo '', $t->output, '
'; - - echo '

Expectancy

'; - echo '', $t->expectancy->expected, ''; - } - - echo '
'; - exit(); - } - - echo '

Test suite

'; - - // phpinfo() links - echo 'phpinfo(): '; - foreach (array( - 1 => 'General', - 4 => 'Configuration', - 8 => 'Modules' - ) as $const => $name) { - printf('%s | ', $const, $name); - } - echo '(All)'; - - echo '

Select one to run

'; - echo '
'; - - echo <<<__ - - -__; - // }}} -?> -- 2.40.0