cvs: pear-core /tests/PEAR_Command setup.php.inc test_registerCommands.phpt test_registerCommands_standard.phpt /tests/PEAR_Command/fakecommands
Foo.php Grunk.php

From: Date: Fri, 26 Nov 2004 19:34:26 +0000
Subject: cvs: pear-core /tests/PEAR_Command setup.php.inc test_registerCommands.phpt test_registerCommands_standard.phpt /tests/PEAR_Command/fakecommands
Foo.php Grunk.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-26529@lists.php.net to get a copy of this message
cellog Fri Nov 26 14:34:26 2004 EDT Added files: /pear-core/tests/PEAR_Command/fakecommands Foo.php Grunk.php /pear-core/tests/PEAR_Command setup.php.inc test_registerCommands.phpt test_registerCommands_standard.phpt Log: new tests

http://cvs.php.net/co.php/pear-core/tests/PEAR_Command/fakecommands/Foo.php?r=1.1&p=1 Index: pear-core/tests/PEAR_Command/fakecommands/Foo.php +++ pear-core/tests/PEAR_Command/fakecommands/Foo.php <?php // // +----------------------------------------------------------------------+ // | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Stig Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // // $Id: Foo.php,v 1.1 2004/11/26 19:34:26 cellog Exp $ require_once "PEAR/Command/Common.php"; /** * PEAR commands for managing configuration data. * */ class PEAR_Command_Foo extends PEAR_Command_Common { // {{{ properties var $commands = array( 'smong' => array( 'summary' => 'Connects and authenticates to remote server', 'shortcut' => 'sm', 'function' => 'doLogin', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'list installed packages from this channel', 'arg' => 'CHAN', ), ), 'doc' => ' Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', ), 'yertl' => array( 'summary' => 'Logs out from the remote server', 'shortcut' => 'ye', 'function' => 'doLogout', 'options' => array( 'channel' => array( 'shortopt' => 'c', 'doc' => 'list installed packages from this channel', ), ), 'doc' => ' Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', ) ); // }}} // {{{ doLogin() /** * Execute the 'login' command. * * @param string $command command name * * @param array $options option_name => value * * @param array $params list of additional parameters * * @return bool TRUE on success, FALSE for unknown commands, or * a PEAR error on failure * * @access public */ function doLogin($command, $options, $params) { } // }}} // {{{ doLogout() /** * Execute the 'logout' command. * * @param string $command command name * * @param array $options option_name => value * * @param array $params list of additional parameters * * @return bool TRUE on success, FALSE for unknown commands, or * a PEAR error on failure * * @access public */ function doLogout($command, $options, $params) { } // }}} } ?> http://cvs.php.net/co.php/pear-core/tests/PEAR_Command/fakecommands/Grunk.php?r=1.1&p=1 Index: pear-core/tests/PEAR_Command/fakecommands/Grunk.php +++ pear-core/tests/PEAR_Command/fakecommands/Grunk.php <?php // // +----------------------------------------------------------------------+ // | PHP Version 5 | // +----------------------------------------------------------------------+ // | Copyright (c) 1997-2004 The PHP Group | // +----------------------------------------------------------------------+ // | This source file is subject to version 3.0 of the PHP license, | // | that is bundled with this package in the file LICENSE, and is | // | available through the world-wide-web at the following url: | // | http://www.php.net/license/3_0.txt. | // | If you did not receive a copy of the PHP license and are unable to | // | obtain it through the world-wide-web, please send a note to | // | license@php.net so we can mail you a copy immediately. | // +----------------------------------------------------------------------+ // | Author: Stig Bakken <ssb@php.net> | // +----------------------------------------------------------------------+ // // $Id: Grunk.php,v 1.1 2004/11/26 19:34:26 cellog Exp $ require_once "PEAR/Command/Common.php"; /** * PEAR commands for managing configuration data. * */ class PEAR_Command_Grunk extends PEAR_Command_Common { // {{{ properties var $commands = array( 'login' => array( 'summary' => 'Connects and authenticates to remote server', 'shortcut' => 'li', 'function' => 'doLogin', 'options' => array(), 'doc' => ' Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', ), 'logout' => array( 'summary' => 'Logs out from the remote server', 'shortcut' => 'lo', 'function' => 'doLogout', 'options' => array(), 'doc' => ' Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', ) ); // }}} // {{{ doLogin() /** * Execute the 'login' command. * * @param string $command command name * * @param array $options option_name => value * * @param array $params list of additional parameters * * @return bool TRUE on success, FALSE for unknown commands, or * a PEAR error on failure * * @access public */ function doLogin($command, $options, $params) { } // }}} // {{{ doLogout() /** * Execute the 'logout' command. * * @param string $command command name * * @param array $options option_name => value * * @param array $params list of additional parameters * * @return bool TRUE on success, FALSE for unknown commands, or * a PEAR error on failure * * @access public */ function doLogout($command, $options, $params) { } // }}} } ?> http://cvs.php.net/co.php/pear-core/tests/PEAR_Command/setup.php.inc?r=1.1&p=1 Index: pear-core/tests/PEAR_Command/setup.php.inc +++ pear-core/tests/PEAR_Command/setup.php.inc <?php $server = 'pear.Chiara'; //$server = 'test.pear.php.net'; $temp_path = dirname(__FILE__) . DIRECTORY_SEPARATOR . 'testinstallertemp'; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'download_test_classes.php.inc'; register_shutdown_function('cleanall'); cleanall($temp_path); $statedir = $temp_path; if (!is_dir($temp_path)) { mkdir($temp_path); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'php')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'php'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'data')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'data'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'doc')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'doc'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'test')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'test'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'ext')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'ext'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'script')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'script'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'tmp')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'tmp'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'bin')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'bin'); } if (!is_dir($temp_path . DIRECTORY_SEPARATOR . 'cache')) { mkdir($temp_path . DIRECTORY_SEPARATOR . 'cache'); } // make the fake configuration - we'll use one of these and it should work $config = serialize(array('master_server' => $server, 'preferred_state' => 'stable', 'cache_dir' => $temp_path . DIRECTORY_SEPARATOR . 'cache', 'php_dir' => $temp_path . DIRECTORY_SEPARATOR . 'php', 'ext_dir' => $temp_path . DIRECTORY_SEPARATOR . 'ext', 'data_dir' => $temp_path . DIRECTORY_SEPARATOR . 'data', 'doc_dir' => $temp_path . DIRECTORY_SEPARATOR . 'doc', 'test_dir' => $temp_path . DIRECTORY_SEPARATOR . 'test', 'bin_dir' => $temp_path . DIRECTORY_SEPARATOR . 'bin',)); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.conf'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.conf', 'w'); fwrite($fp, $config); fclose($fp); touch($temp_path . DIRECTORY_SEPARATOR . 'pear.ini'); $fp = fopen($temp_path . DIRECTORY_SEPARATOR . 'pear.ini', 'w'); fwrite($fp, $config); fclose($fp); putenv('PHP_PEAR_SYSCONF_DIR='.$temp_path); $home = getenv('HOME'); if (!empty($home)) { // for PEAR_Config initialization putenv('HOME="'.$temp_path); } require_once "PEAR/Downloader.php"; require_once dirname(dirname(__FILE__)) . '/download_test_classes.php.inc'; require_once dirname(dirname(__FILE__)) . DIRECTORY_SEPARATOR . 'phpt_test.php.inc'; $phpunit = &new PEAR_PHPTest(true); $fakelog = new fake_log; $config = &PEAR_Config::singleton($temp_path . '/pear.ini'); test_PEAR_Dependency2::singleton($config); require_once 'PEAR/Downloader/Package.php'; /** * @param array * @return PEAR_Downloader_Package */ function &newDownloaderPackage($options) { global $config, $fakelog; $downloader = &new test_PEAR_Downloader($fakelog, $options, $config); $p = &new PEAR_Downloader_Package($downloader); return $p; } require_once 'PEAR/Command.php'; ?> http://cvs.php.net/co.php/pear-core/tests/PEAR_Command/test_registerCommands.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Command/test_registerCommands.phpt +++ pear-core/tests/PEAR_Command/test_registerCommands.phpt --TEST-- PEAR_Command::registerCommands() (non-standard) --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php error_reporting(E_ALL); require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; PEAR_Command::registerCommands(false, dirname(__FILE__) . DIRECTORY_SEPARATOR . 'fakecommands'); $phpunit->showAll(); $phpunit->assertEquals(array ( 'login' => 'PEAR_Command_Grunk', 'logout' => 'PEAR_Command_Grunk', 'smong' => 'PEAR_Command_Foo', 'yertl' => 'PEAR_Command_Foo', ), PEAR_Command::getCommands(), 'getcommands'); $phpunit->assertEquals(array ( 'li' => 'login', 'lo' => 'logout', 'sm' => 'smong', 'ye' => 'yertl', ), PEAR_Command::getShortcuts(), 'getshortcuts'); PEAR_Command::getGetoptArgs('login', $s, $l); $phpunit->assertEquals('', $s, 'short login'); $phpunit->assertEquals(array(), $l, 'long login'); PEAR_Command::getGetoptArgs('logout', $s, $l); $phpunit->assertEquals('', $s, 'short logout'); $phpunit->assertEquals(array(), $l, 'long logout'); PEAR_Command::getGetoptArgs('smong', $s, $l); $phpunit->assertEquals('c:', $s, 'short smong'); $phpunit->assertEquals(array('channel='), $l, 'long smong'); PEAR_Command::getGetoptArgs('yertl', $s, $l); $phpunit->assertEquals('c', $s, 'short yertl'); $phpunit->assertEquals(array('channel'), $l, 'long yertl'); $phpunit->assertEquals('Connects and authenticates to remote server' , PEAR_Command::getDescription('login'), 'login'); $phpunit->assertEquals('Logs out from the remote server' , PEAR_Command::getDescription('logout'), 'logout'); $phpunit->assertEquals('Connects and authenticates to remote server' , PEAR_Command::getDescription('smong'), 'smong'); $phpunit->assertEquals('Logs out from the remote server' , PEAR_Command::getDescription('yertl'), 'yertl'); $phpunit->assertEquals(array ( 0 => ' Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', 1 => NULL, ) , PEAR_Command::getHelp('login'), 'login'); $phpunit->assertEquals(array ( 0 => ' Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', 1 => NULL, ) , PEAR_Command::getHelp('logout'), 'logout'); $phpunit->assertEquals(array ( 0 => ' Log in to the remote server. To use remote functions in the installer that require any kind of privileges, you need to log in first. The username and password you enter here will be stored in your per-user PEAR configuration (~/.pearrc on Unix-like systems). After logging in, your username and password will be sent along in subsequent operations on the remote server.', 1 => 'Options: -c CHAN, --channel=CHAN list installed packages from this channel ', ) , PEAR_Command::getHelp('smong'), 'smong'); $phpunit->assertEquals(array ( 0 => ' Logs out from the remote server. This command does not actually connect to the remote server, it only deletes the stored username and password from your user configuration.', 1 => 'Options: -c, --channel list installed packages from this channel ', ) , PEAR_Command::getHelp('yertl'), 'yertl'); echo 'tests done'; ?> --EXPECT-- tests done http://cvs.php.net/co.php/pear-core/tests/PEAR_Command/test_registerCommands_standard.phpt?r=1.1&p=1 Index: pear-core/tests/PEAR_Command/test_registerCommands_standard.phpt +++ pear-core/tests/PEAR_Command/test_registerCommands_standard.phpt --TEST-- PEAR_Command::factory() --SKIPIF-- <?php if (!getenv('PHP_PEAR_RUNTESTS')) { echo 'skip'; } ?> --FILE-- <?php error_reporting(E_ALL); require_once dirname(__FILE__) . DIRECTORY_SEPARATOR . 'setup.php.inc'; $phpunit->showall(); PEAR_Command::registerCommands(); $phpunit->assertEquals(array ( 'build' => 'PEAR_Command_Build', 'bundle' => 'PEAR_Command_Install', 'channel-add' => 'PEAR_Command_Channels', 'channel-alias' => 'PEAR_Command_Channels', 'channel-delete' => 'PEAR_Command_Channels', 'channel-discover' => 'PEAR_Command_Channels', 'channel-info' => 'PEAR_Command_Channels', 'channel-update' => 'PEAR_Command_Channels', 'clear-cache' => 'PEAR_Command_Remote', 'config-create' => 'PEAR_Command_Config', 'config-get' => 'PEAR_Command_Config', 'config-help' => 'PEAR_Command_Config', 'config-set' => 'PEAR_Command_Config', 'config-show' => 'PEAR_Command_Config', 'convert' => 'PEAR_Command_Package', 'cvsdiff' => 'PEAR_Command_Package', 'cvstag' => 'PEAR_Command_Package', 'download' => 'PEAR_Command_Remote', 'download-all' => 'PEAR_Command_Mirror', 'info' => 'PEAR_Command_Registry', 'install' => 'PEAR_Command_Install', 'list' => 'PEAR_Command_Registry', 'list-all' => 'PEAR_Command_Remote', 'list-channels' => 'PEAR_Command_Channels', 'list-files' => 'PEAR_Command_Registry', 'list-installed' => 'PEAR_Command_Registry', 'list-upgrades' => 'PEAR_Command_Remote', 'login' => 'PEAR_Command_Auth', 'logout' => 'PEAR_Command_Auth', 'makerpm' => 'PEAR_Command_Package', 'package' => 'PEAR_Command_Package', 'package-dependencies' => 'PEAR_Command_Package', 'package-validate' => 'PEAR_Command_Package', 'remote-info' => 'PEAR_Command_Remote', 'remote-list' => 'PEAR_Command_Remote', 'run-tests' => 'PEAR_Command_Package', 'search' => 'PEAR_Command_Remote', 'shell-test' => 'PEAR_Command_Registry', 'sign' => 'PEAR_Command_Package', 'uninstall' => 'PEAR_Command_Install', 'update-channels' => 'PEAR_Command_Channels', 'upgrade' => 'PEAR_Command_Install', 'upgrade-all' => 'PEAR_Command_Install', ), PEAR_Command::getCommands(), 'getcommands'); $phpunit->assertEquals(43, count(PEAR_Command::getCommands()), 'count commands'); $phpunit->assertEquals(43, count(PEAR_Command::getShortcuts()), 'count shortcuts'); $phpunit->assertEquals(array ( 'b' => 'build', 'bun' => 'bundle', 'c2' => 'convert', 'ca' => 'channel-add', 'cc' => 'clear-cache', 'cd' => 'cvsdiff', 'cde' => 'channel-delete', 'cg' => 'config-get', 'ch' => 'config-help', 'cha' => 'channel-alias', 'ci' => 'channel-info', 'coc' => 'config-create', 'cs' => 'config-set', 'csh' => 'config-show', 'ct' => 'cvstag', 'cu' => 'channel-update', 'd' => 'download', 'da' => 'download-all', 'di' => 'channel-discover', 'fl' => 'list-files', 'i' => 'install', 'in' => 'info', 'l' => 'list', 'la' => 'list-all', 'lc' => 'list-channels', 'li' => 'login', 'lin' => 'list-installed', 'lo' => 'logout', 'lu' => 'list-upgrades', 'p' => 'package', 'pd' => 'package-dependencies', 'pv' => 'package-validate', 'ri' => 'remote-info', 'rl' => 'remote-list', 'rpm' => 'makerpm', 'rt' => 'run-tests', 'si' => 'sign', 'sp' => 'search', 'st' => 'shell-test', 'ua' => 'upgrade-all', 'uc' => 'update-channels', 'un' => 'uninstall', 'up' => 'upgrade', ), PEAR_Command::getShortcuts(), 'getshortcuts'); PEAR_Command::getGetoptArgs('build', $s, $l); $phpunit->assertEquals('', $s, 'short build'); $phpunit->assertEquals(array(), $l, 'long build'); PEAR_Command::getGetoptArgs('bundle', $s, $l); $phpunit->assertEquals('d:f', $s, 'short bundle'); $phpunit->assertEquals(array('destination=', 'force'), $l, 'long bundle'); PEAR_Command::getGetoptArgs('channel-add', $s, $l); $phpunit->assertEquals('', $s, 'short channel-add'); $phpunit->assertEquals(array(), $l, 'long channel-add'); PEAR_Command::getGetoptArgs('channel-alias', $s, $l); $phpunit->assertEquals('', $s, 'short channel-alias'); $phpunit->assertEquals(array(), $l, 'long channel-alias'); PEAR_Command::getGetoptArgs('channel-delete', $s, $l); $phpunit->assertEquals('', $s, 'short channel-delete'); $phpunit->assertEquals(array(), $l, 'long channel-delete'); PEAR_Command::getGetoptArgs('channel-discover', $s, $l); $phpunit->assertEquals('', $s, 'short channel-discover'); $phpunit->assertEquals(array(), $l, 'long channel-discover'); PEAR_Command::getGetoptArgs('channel-info', $s, $l); $phpunit->assertEquals('', $s, 'short channel-info'); $phpunit->assertEquals(array(), $l, 'long channel-info'); PEAR_Command::getGetoptArgs('channel-update', $s, $l); $phpunit->assertEquals('f', $s, 'short channel-update'); $phpunit->assertEquals(array('force'), $l, 'long channel-update'); PEAR_Command::getGetoptArgs('clear-cache', $s, $l); $phpunit->assertEquals('', $s, 'short clear-cache'); $phpunit->assertEquals(array(), $l, 'long clear-cache'); PEAR_Command::getGetoptArgs('config-create', $s, $l); $phpunit->assertEquals('', $s, 'short config-create'); $phpunit->assertEquals(array(), $l, 'long config-create'); PEAR_Command::getGetoptArgs('config-get', $s, $l); $phpunit->assertEquals('c:', $s, 'short config-get'); $phpunit->assertEquals(array('channel='), $l, 'long config-get'); PEAR_Command::getGetoptArgs('config-set', $s, $l); $phpunit->assertEquals('c:', $s, 'short config-set'); $phpunit->assertEquals(array('channel='), $l, 'long config-set'); PEAR_Command::getGetoptArgs('config-show', $s, $l); $phpunit->assertEquals('c:', $s, 'short config-show'); $phpunit->assertEquals(array('channel='), $l, 'long config-show'); PEAR_Command::getGetoptArgs('convert', $s, $l); $phpunit->assertEquals('f', $s, 'short convert'); $phpunit->assertEquals(array('flat'), $l, 'long convert'); PEAR_Command::getGetoptArgs('cvsdiff', $s, $l); $phpunit->assertEquals('qQD:R:r:cuibBn', $s, 'short cvsdiff'); $phpunit->assertEquals(array ( 0 => 'quiet', 1 => 'reallyquiet', 2 => 'date=', 3 => 'release=', 4 => 'revision=', 5 => 'context', 6 => 'unified', 7 => 'ignore-case', 8 => 'ignore-whitespace', 9 => 'ignore-blank-lines', 10 => 'brief', 11 => 'dry-run', ), $l, 'long cvsdiff'); PEAR_Command::getGetoptArgs('cvstag', $s, $l); $phpunit->assertEquals('qQFdn', $s, 'short cvstag'); $phpunit->assertEquals(array ( 0 => 'quiet', 1 => 'reallyquiet', 2 => 'slide', 3 => 'delete', 4 => 'dry-run', ), $l, 'long cvstag'); PEAR_Command::getGetoptArgs('download', $s, $l); $phpunit->assertEquals('Z', $s, 'short download'); $phpunit->assertEquals(array('nocompress'), $l, 'long download'); PEAR_Command::getGetoptArgs('download-all', $s, $l); $phpunit->assertEquals('c:', $s, 'short download-all'); $phpunit->assertEquals(array('channel='), $l, 'long download-all'); PEAR_Command::getGetoptArgs('info', $s, $l); $phpunit->assertEquals('', $s, 'short info'); $phpunit->assertEquals(array(), $l, 'long info'); PEAR_Command::getGetoptArgs('install', $s, $l); $phpunit->assertEquals('fnrsBZR:aorc:ol', $s, 'short install'); $phpunit->assertEquals(array ( 0 => 'force', 1 => 'nodeps', 2 => 'register-only', 3 => 'soft', 4 => 'nobuild', 5 => 'nocompress', 6 => 'installroot=', 7 => 'ignore-errors', 8 => 'alldeps', 9 => 'onlyreqdeps', 10 => 'remoteconfig=', 11 => 'offline', ), $l, 'long install'); PEAR_Command::getGetoptArgs('list', $s, $l); $phpunit->assertEquals('c:', $s, 'short list'); $phpunit->assertEquals(array('channel='), $l, 'long list'); PEAR_Command::getGetoptArgs('list-all', $s, $l); $phpunit->assertEquals('c:', $s, 'short list-all'); $phpunit->assertEquals(array('channel='), $l, 'long list-all'); PEAR_Command::getGetoptArgs('list-channels', $s, $l); $phpunit->assertEquals('', $s, 'short list-channels'); $phpunit->assertEquals(array(), $l, 'long list-channels'); PEAR_Command::getGetoptArgs('list-files', $s, $l); $phpunit->assertEquals('', $s, 'short list-files'); $phpunit->assertEquals(array(), $l, 'long list-files'); PEAR_Command::getGetoptArgs('list-installed', $s, $l); $phpunit->assertEquals('', $s, 'short list-installed'); $phpunit->assertEquals(array(), $l, 'long list-installed'); PEAR_Command::getGetoptArgs('list-upgrades', $s, $l); $phpunit->assertEquals('', $s, 'short list-upgrades'); $phpunit->assertEquals(array(), $l, 'long list-upgrades'); PEAR_Command::getGetoptArgs('login', $s, $l); $phpunit->assertEquals('', $s, 'short login'); $phpunit->assertEquals(array(), $l, 'long login'); PEAR_Command::getGetoptArgs('logout', $s, $l); $phpunit->assertEquals('', $s, 'short logout'); $phpunit->assertEquals(array(), $l, 'long logout'); PEAR_Command::getGetoptArgs('makerpm', $s, $l); $phpunit->assertEquals('t:p:', $s, 'short makerpm'); $phpunit->assertEquals(array( 0 => 'spec-template=', 1 => 'rpm-pkgname=', ), $l, 'long makerpm'); PEAR_Command::getGetoptArgs('package', $s, $l); $phpunit->assertEquals('Zn', $s, 'short package'); $phpunit->assertEquals(array ( 0 => 'nocompress', 1 => 'showname', ), $l, 'long package'); PEAR_Command::getGetoptArgs('package-dependencies', $s, $l); $phpunit->assertEquals('', $s, 'short package-dependencies'); $phpunit->assertEquals(array (), $l, 'long package-dependencies'); PEAR_Command::getGetoptArgs('package-validate', $s, $l); $phpunit->assertEquals('', $s, 'short package-validate'); $phpunit->assertEquals(array (), $l, 'long package-validate'); PEAR_Command::getGetoptArgs('remote-info', $s, $l); $phpunit->assertEquals('', $s, 'short remote-info'); $phpunit->assertEquals(array (), $l, 'long remote-info'); PEAR_Command::getGetoptArgs('remote-list', $s, $l); $phpunit->assertEquals('c:', $s, 'short remote-list'); $phpunit->assertEquals(array ('channel='), $l, 'long remote-list'); PEAR_Command::getGetoptArgs('run-tests', $s, $l); $phpunit->assertEquals('r', $s, 'short run-tests'); $phpunit->assertEquals(array ('recur'), $l, 'long run-tests'); PEAR_Command::getGetoptArgs('search', $s, $l); $phpunit->assertEquals('c:', $s, 'short search'); $phpunit->assertEquals(array ('channel='), $l, 'long search'); PEAR_Command::getGetoptArgs('shell-test', $s, $l); $phpunit->assertEquals('', $s, 'short shell-test'); $phpunit->assertEquals(array (), $l, 'long shell-test'); PEAR_Command::getGetoptArgs('sign', $s, $l); $phpunit->assertEquals('', $s, 'short sign'); $phpunit->assertEquals(array (), $l, 'long sign'); PEAR_Command::getGetoptArgs('uninstall', $s, $l); $phpunit->assertEquals('nrR:rc:', $s, 'short uninstall'); $phpunit->assertEquals(array ( 0 => 'nodeps', 1 => 'register-only', 2 => 'installroot=', 3 => 'ignore-errors', 4 => 'remoteconfig=', ), $l, 'long uninstall'); PEAR_Command::getGetoptArgs('update-channels', $s, $l); $phpunit->assertEquals('', $s, 'short update-channels'); $phpunit->assertEquals(array (), $l, 'long update-channels'); PEAR_Command::getGetoptArgs('upgrade', $s, $l); $phpunit->assertEquals('fnrBZR:aorc:ol', $s, 'short upgrade'); $phpunit->assertEquals(array ( 0 => 'force', 1 => 'nodeps', 2 => 'register-only', 3 => 'nobuild', 4 => 'nocompress', 5 => 'installroot=', 6 => 'ignore-errors', 7 => 'alldeps', 8 => 'onlyreqdeps', 9 => 'remoteconfig=', 10 => 'offline', ), $l, 'long upgrade'); PEAR_Command::getGetoptArgs('upgrade-all', $s, $l); $phpunit->assertEquals('nrBZR:rc:', $s, 'short upgrade-all'); $phpunit->assertEquals(array ( 0 => 'nodeps', 1 => 'register-only', 2 => 'nobuild', 3 => 'nocompress', 4 => 'installroot=', 5 => 'ignore-errors', 6 => 'remoteconfig=', ), $l, 'long upgrade-all'); $phpunit->assertEquals('Build an Extension From C Source' , PEAR_Command::getDescription('build'), 'build'); $phpunit->assertEquals('Unpacks a Pecl Package' , PEAR_Command::getDescription('bundle'), 'bundle'); $phpunit->assertEquals('Add a Channel' , PEAR_Command::getDescription('channel-add'), 'channel-add'); $phpunit->assertEquals('Specify an alias to a channel name' , PEAR_Command::getDescription('channel-alias'), 'channel-alias'); $phpunit->assertEquals('Remove a Channel From the List' , PEAR_Command::getDescription('channel-delete'), 'channel-delete'); $phpunit->assertEquals('Initialize a Channel from its server' , PEAR_Command::getDescription('channel-discover'), 'channel-discover'); $phpunit->assertEquals('Retrieve Information on a Channel' , PEAR_Command::getDescription('channel-info'), 'channel-info'); $phpunit->assertEquals('Update an Existing Channel' , PEAR_Command::getDescription('channel-update'), 'channel-update'); $phpunit->assertEquals('Clear XML-RPC Cache' , PEAR_Command::getDescription('clear-cache'), 'clear-cache'); $phpunit->assertEquals('Create a Default configuration file' , PEAR_Command::getDescription('config-create'), 'config-create'); $phpunit->assertEquals('Show One Setting' , PEAR_Command::getDescription('config-get'), 'config-get'); $phpunit->assertEquals('Show Information About Setting' , PEAR_Command::getDescription('config-help'), 'config-help'); $phpunit->assertEquals('Change Setting' , PEAR_Command::getDescription('config-set'), 'config-set'); $phpunit->assertEquals('Show All Settings' , PEAR_Command::getDescription('config-show'), 'config-show'); $phpunit->assertEquals('Convert a package.xml 1.0 to package.xml 2.0 format' , PEAR_Command::getDescription('convert'), 'convert'); $phpunit->assertEquals('Run a "cvs diff" for all files in a package' , PEAR_Command::getDescription('cvsdiff'), 'cvsdiff'); $phpunit->assertEquals('Set CVS Release Tag' , PEAR_Command::getDescription('cvstag'), 'cvstag'); $phpunit->assertEquals('Download Package' , PEAR_Command::getDescription('download'), 'download'); $phpunit->assertEquals('Downloads each available package from master_server' , PEAR_Command::getDescription('download-all'), 'download-all'); $phpunit->assertEquals('Display information about a package' , PEAR_Command::getDescription('info'), 'info'); $phpunit->assertEquals('Install Package' , PEAR_Command::getDescription('install'), 'install'); $phpunit->assertEquals('List Installed Packages In The Default Channel' , PEAR_Command::getDescription('list'), 'list'); $phpunit->assertEquals('List All Packages' , PEAR_Command::getDescription('list-all'), 'list-all'); $phpunit->assertEquals('List Available Channels' , PEAR_Command::getDescription('list-channels'), 'list-channels'); $phpunit->assertEquals('List Files In Installed Package' , PEAR_Command::getDescription('list-files'), 'list-files'); $phpunit->assertEquals('List All Installed Packages In All Channels' , PEAR_Command::getDescription('list-installed'), 'list-installed'); $phpunit->assertEquals('List Available Upgrades' , PEAR_Command::getDescription('list-upgrades'), 'list-upgrades'); $phpunit->assertEquals('Connects and authenticates to remote server' , PEAR_Command::getDescription('login'), 'login'); $phpunit->assertEquals('Logs out from the remote server' , PEAR_Command::getDescription('logout'), 'logout'); $phpunit->assertEquals('Builds an RPM spec file from a PEAR package' , PEAR_Command::getDescription('makerpm'), 'makerpm'); $phpunit->assertEquals('Build Package' , PEAR_Command::getDescription('package'), 'package'); $phpunit->assertEquals('Show package dependencies' , PEAR_Command::getDescription('package-dependencies'), 'package-dependencies'); $phpunit->assertEquals('Validate Package Consistency' , PEAR_Command::getDescription('package-validate'), 'package-validate'); $phpunit->assertEquals('Information About Remote Packages' , PEAR_Command::getDescription('remote-info'), 'remote-info'); $phpunit->assertEquals('List Remote Packages' , PEAR_Command::getDescription('remote-list'), 'remote-list'); $phpunit->assertEquals('Run Regression Tests' , PEAR_Command::getDescription('run-tests'), 'run-tests'); $phpunit->assertEquals('Search remote package database' , PEAR_Command::getDescription('search'), 'search'); $phpunit->assertEquals('Shell Script Test' , PEAR_Command::getDescription('shell-test'), 'shell-test'); $phpunit->assertEquals('Sign a package distribution file' , PEAR_Command::getDescription('sign'), 'sign'); $phpunit->assertEquals('Un-install Package' , PEAR_Command::getDescription('uninstall'), 'uninstall'); $phpunit->assertEquals('Update the Channel List' , PEAR_Command::getDescription('update-channels'), 'update-channels'); $phpunit->assertEquals('Upgrade Package' , PEAR_Command::getDescription('upgrade'), 'upgrade'); $phpunit->assertEquals('Upgrade All Packages' , PEAR_Command::getDescription('upgrade-all'), 'upgrade-all'); echo 'tests done'; ?> --EXPECT-- tests done
« previous php.pear.cvs (#26529) next »