cvs: pear-core /tests/PEAR_PackageFile/v1 test_dependencies.phpt
| From: | Greg Beaver | Date: | Thu, 28 Oct 2004 03:36:33 +0000 |
| Subject: | cvs: pear-core /tests/PEAR_PackageFile/v1 test_dependencies.phpt | ||
| Groups: | php.pear.cvs php.pear.core | ||
| Request: | Send a blank email to pear-core+get-1169@lists.php.net to get a copy of this message | ||
cellog Wed Oct 27 23:36:33 2004 EDT
Added files:
/pear-core/tests/PEAR_PackageFile/v1 test_dependencies.phpt
Log:
new test for packagefile v1 dependencies manipulation
http://cvs.php.net/co.php/pear-core/tests/PEAR_PackageFile/v1/test_dependencies.phpt?r=1.1&p=1
Index: pear-core/tests/PEAR_PackageFile/v1/test_dependencies.phpt
+++ pear-core/tests/PEAR_PackageFile/v1/test_dependencies.phpt
--TEST--
PEAR_PackageFile_Parser_v1 dependencies
--SKIPIF--
<?php
if (!getenv('PHP_PEAR_RUNTESTS')) {
echo 'skip';
}
?>
--FILE--
<?php
require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc';
$pathtopackagexml = dirname(__FILE__) . DIRECTORY_SEPARATOR .
'Parser'. DIRECTORY_SEPARATOR .
'test_basicparse'. DIRECTORY_SEPARATOR . 'package.xml';
$pf = &$parser->parse(implode('', file($pathtopackagexml)), $pathtopackagexml);
$phpunit->assertNoErrors('valid xml parse');
$phpunit->assertIsa('PEAR_PackageFile_v1', $pf, 'return of valid parse');
$phpunit->showall();
$phpunit->assertFalse($pf->getDeps(), 'pre-set');
//$pf = new PEAR_PackageFile_v1;
$pf->addPhpDep('4.5.6', 'ge');
$phpunit->assertEquals(array (
0 =>
array (
'type' => 'php',
'rel' => 'ge',
'version' => '4.5.6',
),
), $pf->getDeps(), 'php set failed');
$pf->clearDeps();
$phpunit->assertFalse($pf->getDeps(), 'cleardeps');
$pf->addPackageDep('foo', '1.0', 'not');
$phpunit->assertEquals(array (
0 =>
array (
'type' => 'pkg',
'name' => 'foo',
'rel' => 'not',
'version' => '1.0',
'optional' => 'no',
),
), $pf->getDeps(), 'package set failed');
$pf->clearDeps();
$pf->addExtensionDep('flah', '2.0', 'le');
$phpunit->assertEquals(array (
0 =>
array (
'type' => 'ext',
'name' => 'flah',
'rel' => 'le',
'version' => '2.0',
'optional' => 'no',
),
), $pf->getDeps(), 'extension set failed');
$result = $pf->validate(PEAR_VALIDATE_NORMAL);
$phpunit->assertEquals(array(), $fakelog->getLog(), 'normal validate empty log');
$phpunit->assertNoErrors('after validation');
$result = $pf->validate(PEAR_VALIDATE_INSTALLING);
$phpunit->assertEquals(array(), $fakelog->getLog(), 'installing validate empty
log');
$phpunit->assertNoErrors('after validation');
$result = $pf->validate(PEAR_VALIDATE_DOWNLOADING);
$phpunit->assertEquals(array(), $fakelog->getLog(), 'downloading validate empty
log');
$phpunit->assertNoErrors('after validation');
$result = $pf->validate(PEAR_VALIDATE_PACKAGING);
$phpunit->showall();
$phpunit->assertEquals(array (
0 =>
array (
0 => 1,
1 => 'Analyzing test/test.php',
),
1 =>
array (
0 => 1,
1 => 'Analyzing test/test2.php',
),
2 =>
array (
0 => 1,
1 => 'Analyzing test/test3.php',
),
), $fakelog->getLog(), 'packaging validate full log');
$phpunit->assertNoErrors('after validation');
echo 'tests done';
?>
--EXPECT--
tests done