cvs: pear-core /tests/PEAR_Dependency2 test_checkPackageDependency_PEAR_exclude.phpt
| From: | Greg Beaver | Date: | Thu, 21 Oct 2004 15:21:33 +0000 |
| Subject: | cvs: pear-core /tests/PEAR_Dependency2 test_checkPackageDependency_PEAR_exclude.phpt | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-1095@lists.php.net to get a copy of this message | ||
cellog Thu Oct 21 11:21:33 2004 EDT
Modified files:
/pear-core/tests/PEAR_Dependency2
test_checkPackageDependency_PEAR_exclude.phpt
Log:
complete unit test
http://cvs.php.net/diff.php/pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_exclude.phpt?r1=1.1&r2=1.2&ty=u
Index: pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_exclude.phpt
diff -u pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_exclude.phpt:1.1
pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_exclude.phpt:1.2
--- pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_exclude.phpt:1.1 Mon Oct 18
14:49:25 2004
+++ pear-core/tests/PEAR_Dependency2/test_checkPackageDependency_PEAR_exclude.phpt Thu Oct 21
11:21:33 2004
@@ -1,5 +1,5 @@
--TEST--
-PEAR_Dependency2->checkPackageDependency() exclude failure
+PEAR_Dependency2->checkPackageDependency() exclude failure (installed package)
--SKIPIF--
<?php
if (!getenv('PHP_PEAR_RUNTESTS')) {
@@ -40,22 +40,29 @@
array('package' => 'PEAR_Error',
'message' => 'channel://pear.php.net/mine is not compatible with
installed package "channel://pear.php.net/foo" version 1.0')
), 'exclude 1');
+$phpunit->assertEquals(array(), $fakelog->getLog(), 'exclude 1 log');
$phpunit->assertIsa('PEAR_Error', $result, 'exclude 1');
-$reg->deletePackage('foo');
-
-$dep = &new test_PEAR_Dependency2($config, array(), array('channel' =>
'pear.php.net',
- 'package' => 'mine'), PEAR_VALIDATE_DOWNLOADING);
-$phpunit->assertNoErrors('create 1');
+// nodeps
+$dep = &new test_PEAR_Dependency2($config, array('nodeps' => true),
array('channel' => 'pear.php.net',
+ 'package' => 'mine'), PEAR_VALIDATE_INSTALLING);
+$result = $dep->validatePackageDependency(
+ array(
+ 'name' => 'foo',
+ 'channel' => 'pear.php.net',
+ 'min' => '0.9',
+ 'max' => '1.9',
+ 'exclude' => '1.0',
+ ), true, array());
+$phpunit->showall();
+$phpunit->assertNoErrors('exclude 2 nodeps');
+$phpunit->assertEquals(array(), $fakelog->getLog(), 'exclude 2 log nodeps');
+$phpunit->assertEquals(array('warning: channel://pear.php.net/mine is not compatible with
installed package "channel://pear.php.net/foo" version 1.0'), $result, 'exclude
2 nodeps');
-require_once 'PEAR/Downloader/Package.php';
-require_once 'PEAR/Downloader.php';
-$down = new PEAR_Downloader($fakelog, array(), $config);
-$dp = &new PEAR_Downloader_Package($down);
-$dp->initialize(dirname(__FILE__) . DIRECTORY_SEPARATOR . 'packages' .
DIRECTORY_SEPARATOR .
- 'package.xml');
-$params = array(&$dp);
+// force
+$dep = &new test_PEAR_Dependency2($config, array('force' => true),
array('channel' => 'pear.php.net',
+ 'package' => 'mine'), PEAR_VALIDATE_INSTALLING);
$result = $dep->validatePackageDependency(
array(
@@ -64,12 +71,11 @@
'min' => '0.9',
'max' => '1.9',
'exclude' => '1.0',
- ), true, $params);
-$phpunit->assertErrors(array(
- array('package' => 'PEAR_Error',
- 'message' => 'channel://pear.php.net/mine is not compatible with
downloaded package "channel://pear.php.net/foo" version 1.0')
-), 'exclude 2');
-$phpunit->assertIsa('PEAR_Error', $result, 'exclude 2');
+ ), true, array());
+$phpunit->showall();
+$phpunit->assertNoErrors('exclude 2 force');
+$phpunit->assertEquals(array(), $fakelog->getLog(), 'exclude 2 log force');
+$phpunit->assertEquals(array('warning: channel://pear.php.net/mine is not compatible with
installed package "channel://pear.php.net/foo" version 1.0'), $result, 'exclude
2 force');
echo 'tests done';
?>