From: Greg Beaver Date: Tue, 9 Sep 2003 23:40:39 +0000 (+0000) Subject: first step in unit testing the installer - tests the download PREG function X-Git-Tag: RELEASE_0_7~155 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=79852dfa55d57375a42b3e53c20c6631d5f2716e;p=php first step in unit testing the installer - tests the download PREG function --- diff --git a/pear/tests/pear_installer1.phpt b/pear/tests/pear_installer1.phpt new file mode 100644 index 0000000000..7f2217cdee --- /dev/null +++ b/pear/tests/pear_installer1.phpt @@ -0,0 +1,61 @@ +--TEST-- +PEAR_Installer test #1 +--SKIPIF-- +skip +--FILE-- + 'pear.php.net', 'php_dir' => $temp_path)); +touch($temp_path . DIRECTORY_SEPARATOR . 'user.conf'); +$fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'user.conf', 'w'); +fwrite($fp, $config); +fclose($fp); +echo "test extractDownloadFileName:\n"; +echo 'existing file: '; +echo $installer->extractDownloadFileName($temp_path . DIRECTORY_SEPARATOR . 'user.conf', + $ui); +var_dump($ui); +echo 'invalid match: '; +echo $installer->extractDownloadFileName('27', + $ui); +echo "\n"; +var_dump($ui); +echo 'valid match, no version: '; +echo $installer->extractDownloadFileName('Testpackage', $ui); +echo "\n"; +var_dump($ui); +echo 'invalid match, has invalid version: '; +echo $installer->extractDownloadFileName('Testpackage-##', $ui); +echo "\n"; +var_dump($ui); +echo 'valid match, has version: '; +echo $installer->extractDownloadFileName('Testpackage-1.2', $ui); +echo "\n"; +var_dump($ui); +// '/^([A-Z][a-zA-Z0-9_]+|[a-z][a-z0-9_]+)(-([.0-9a-zA-Z]+))?$/' +unlink ($temp_path . DIRECTORY_SEPARATOR . 'user.conf'); +rmdir($temp_path); +?> +--GET-- +--POST-- +--EXPECT-- +test extractDownloadFileName: +existing file: c:\web pages\chiara\testinstallertemp\user.confbool(false) +invalid match: 27 +NULL +valid match, no version: Testpackage +NULL +invalid match, has invalid version: Testpackage-## +NULL +valid match, has version: Testpackage +string(3) "1.2" \ No newline at end of file