cvs: php-src /pear/tests pear_installer3.phpt

From: Date: Wed, 17 Sep 2003 00:00:22 +0000
Subject: cvs: php-src /pear/tests pear_installer3.phpt
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-12788@lists.php.net to get a copy of this message
cellog Tue Sep 16 20:00:22 2003 EDT Modified files: /php-src/pear/tests pear_installer3.phpt Log: some beginning tests for commitFileTransaction() Index: php-src/pear/tests/pear_installer3.phpt diff -u php-src/pear/tests/pear_installer3.phpt:1.1 php-src/pear/tests/pear_installer3.phpt:1.2 --- php-src/pear/tests/pear_installer3.phpt:1.1 Tue Sep 16 19:43:47 2003 +++ php-src/pear/tests/pear_installer3.phpt Tue Sep 16 20:00:21 2003 @@ -60,7 +60,7 @@ // no UI is needed for these tests $ui = false; $installer = new PEAR_Installer($ui); -$installer->debug = 3; // hack debugging in +$installer->debug = 2; // hack debugging in $curdir = getcwd(); chdir(dirname(__FILE__)); @@ -72,6 +72,45 @@ if (get_class($err) == 'pear_error') { echo $err->getMessage() . "\n"; } +echo 'count($installer->file_operations) = '; +var_dump(count($installer->file_operations)); +echo "Do valid addFileOperation() delete\n"; +touch($temp_path . DIRECTORY_SEPARATOR . 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt'); +$installer->addFileOperation('delete', array($temp_path . DIRECTORY_SEPARATOR . + 'tmp' . DIRECTORY_SEPARATOR . 'installertestfooblah.phpt')); +echo 'count($installer->file_operations) = '; +var_dump(count($installer->file_operations)); + +echo "test valid commitFileTransaction():\n"; +if ($installer->commitFileTransaction()) { + echo "worked\n"; +} else { + echo "didn't work!\n"; +} + +echo "Do valid addFileOperation() delete with non-existing file\n"; +$installer->addFileOperation('delete', array('gloober62456.phpt')); +echo 'count($installer->file_operations) = '; +var_dump(count($installer->file_operations)); + +echo "test invalid commitFileTransaction():\n"; +if ($installer->commitFileTransaction()) { + echo "worked\n"; +} else { + echo "didn't work!\n"; +} + +echo "Do valid addFileOperation() rename with non-existing file\n"; +$installer->addFileOperation('rename', array('gloober62456.phpt', 'faber.com')); +echo 'count($installer->file_operations) = '; +var_dump(count($installer->file_operations)); + +echo "test invalid commitFileTransaction():\n"; +if ($installer->commitFileTransaction()) { + echo "worked\n"; +} else { + echo "didn't work!\n"; +} //cleanup chdir($curdir); @@ -94,3 +133,23 @@ invalid input to addFileOperation(): Returned PEAR_Error? yes Internal Error: $data in addFileOperation must be an array, was integer +count($installer->file_operations) = int(0) +Do valid addFileOperation() delete +count($installer->file_operations) = int(1) +test valid commitFileTransaction(): +about to commit 1 file operations +successfully committed 1 file operations +worked +Do valid addFileOperation() delete with non-existing file +count($installer->file_operations) = int(1) +test invalid commitFileTransaction(): +about to commit 1 file operations +warning: file gloober62456.phpt doesn't exist, can't be deleted +successfully committed 1 file operations +worked +Do valid addFileOperation() rename with non-existing file +count($installer->file_operations) = int(1) +test invalid commitFileTransaction(): +about to commit 1 file operations +cannot rename file gloober62456.phpt, doesn't exist +didn't work!

« previous php.pear.cvs (#12788) next »