cvs: php-src /pear/tests pear_installer2.phpt
| From: | Greg Beaver | Date: | Tue, 16 Sep 2003 03:16:46 +0000 |
| Subject: | cvs: php-src /pear/tests pear_installer2.phpt | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-12767@lists.php.net to get a copy of this message | ||
cellog Mon Sep 15 23:16:46 2003 EDT
Modified files:
/php-src/pear/tests pear_installer2.phpt
Log:
add tests for invalid replacements
Index: php-src/pear/tests/pear_installer2.phpt
diff -u php-src/pear/tests/pear_installer2.phpt:1.7 php-src/pear/tests/pear_installer2.phpt:1.8
--- php-src/pear/tests/pear_installer2.phpt:1.7 Sun Sep 14 23:14:12 2003
+++ php-src/pear/tests/pear_installer2.phpt Mon Sep 15 23:16:46 2003
@@ -188,6 +188,22 @@
}
$installer->rollbackFileTransaction();
+echo "==>test invalid php-const replacement:\n";
+$err = $installer->_installFile('installer2.phpt.testfile.php', array('role'
=> 'script',
+ 'replacements' => array(array('type' => 'php-const',
'from' => '@TEST@', 'to' =>
'%PEARINSTALLERTEST2_FAKE_FOO_CONST'))),
+ $temp_path . DIRECTORY_SEPARATOR . 'tmp', array());
+if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR .
+ '.tmpinstaller2.phpt.testfile.php'))
+{
+ $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR .
+ '.tmpinstaller2.phpt.testfile.php'), '');
+ echo "$a\n";
+} else {
+ echo "no! file installation failed\n";
+}
+
+$installer->rollbackFileTransaction();
+
var_dump($installer->_installFile('installer2.phpt.testfile.php',
array('role' => 'script',
'replacements' => array(array('type' => 'pear-config',
'from' => '@TEST@', 'to' => 'master_server'))),
$temp_path . DIRECTORY_SEPARATOR . 'tmp', array()));
@@ -203,6 +219,21 @@
}
$installer->rollbackFileTransaction();
+echo "==>test invalid pear-config replacement\n";
+var_dump($installer->_installFile('installer2.phpt.testfile.php',
array('role' => 'script',
+ 'replacements' => array(array('type' => 'pear-config',
'from' => '@TEST@', 'to' => 'blahblahblah'))),
+ $temp_path . DIRECTORY_SEPARATOR . 'tmp', array()));
+if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR .
+ '.tmpinstaller2.phpt.testfile.php'))
+{
+ $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR .
+ '.tmpinstaller2.phpt.testfile.php'), '');
+ echo "$a\n";
+} else {
+ echo "no! file installation failed\n";
+}
+$installer->rollbackFileTransaction();
+
var_dump($installer->_installFile('installer2.phpt.testfile.php',
array('role' => 'script',
'replacements' => array(array('type' => 'package-info',
'from' => '@TEST@', 'to' => 'package'))),
$temp_path . DIRECTORY_SEPARATOR . 'tmp', array()));
@@ -218,6 +249,21 @@
}
$installer->rollbackFileTransaction();
+echo "==>test invalid package-info replacement:\n";
+var_dump($installer->_installFile('installer2.phpt.testfile.php',
array('role' => 'script',
+ 'replacements' => array(array('type' => 'package-info',
'from' => '@TEST@', 'to' => 'gronk'))),
+ $temp_path . DIRECTORY_SEPARATOR . 'tmp', array()));
+if (file_exists($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR .
+ '.tmpinstaller2.phpt.testfile.php'))
+{
+ $a = implode(file($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR .
+ '.tmpinstaller2.phpt.testfile.php'), '');
+ echo "$a\n";
+} else {
+ echo "no! file installation failed\n";
+}
+$installer->rollbackFileTransaction();
+
echo "\ntest install-as:\n";
var_dump($installer->_installFile('installer2.phpt.testfile.php',
array('role' => 'script',
'install-as' => 'foobar.php'),
@@ -250,9 +296,7 @@
'Foo' . DIRECTORY_SEPARATOR . 'Mine');
rmdir($temp_path . DIRECTORY_SEPARATOR . 'bin' . DIRECTORY_SEPARATOR .
'Foo');
-
unlink($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR .
'installer2.phpt.testfile.php');
-
//cleanup
chdir($curdir);
unlink ($temp_path . DIRECTORY_SEPARATOR . 'pear.conf');
@@ -317,10 +361,21 @@
test replacements:
int(1)
==>test php-const replacement: equals 'good stuff'? => good stuff
+==>test invalid php-const replacement:
+invalid php-const replacement: %PEARINSTALLERTEST2_FAKE_FOO_CONST
+@TEST@ stuff
int(1)
==>test pear-config replacement: equals 'pear.php.net stuff'? => pear.php.net stuff
+==>test invalid pear-config replacement
+invalid pear-config replacement: blahblahblah
+int(1)
+@TEST@ stuff
int(1)
==>test package-info replacement: equals 'Foo stuff'? => Foo stuff
+==>test invalid package-info replacement:
+invalid package-info replacement: gronk
+int(1)
+@TEST@ stuff
test install-as:
int(1)