cvs: pear /Net_Cyrus Cyrus.php test_cyrus.php

From: Date: Wed, 22 Mar 2006 04:02:54 +0000
Subject: cvs: pear /Net_Cyrus Cyrus.php test_cyrus.php
Groups: php.pear.cvs 
Request: Send a blank email to pear-cvs+get-39231@lists.php.net to get a copy of this message
amistry Wed Mar 22 04:02:54 2006 UTC Modified files: /pear/Net_Cyrus Cyrus.php test_cyrus.php Log: Fix Bug #5778. Add renameUser to the test cases. Properly clean up after the test cases have finished running. Fix a problem where the connection information isn't saved when no arguments are passed to the constructor. http://cvs.php.net/viewcvs.cgi/pear/Net_Cyrus/Cyrus.php?r1=1.2&r2=1.3&diff_format=u Index: pear/Net_Cyrus/Cyrus.php diff -u pear/Net_Cyrus/Cyrus.php:1.2 pear/Net_Cyrus/Cyrus.php:1.3 --- pear/Net_Cyrus/Cyrus.php:1.2 Wed Mar 22 03:15:53 2006 +++ pear/Net_Cyrus/Cyrus.php Wed Mar 22 04:02:54 2006 @@ -96,6 +96,12 @@ return $ret; } }else{ + // Save this information if we aren't in the hack case so that any other + // calls to the internal functions still work. + $this->_user = $user; + $this->_pass = $pass; + $this->_host = $host; + $this->_port = $port; if (PEAR::isError($ret = parent::connect($host, $port) )){ return $ret; } @@ -480,22 +486,19 @@ function renameUser($oldUser, $newUser) { - $oldUser =$this->getUserName($oldUser); - - $newUser =$this->getUserName($newUser); - - $oldUsername = $this->getUserName($oldUser,false); $newUsername = $this->getUserName($newUser,false); + $oldUser =$this->getUserName($oldUser); + $newUser =$this->getUserName($newUser); + // Check new user doesn't already exist and old user exists if (!$this->userExists($oldUsername) ) { $msg=sprintf('The user "%s" doesn\'t exist', $oldUsername); $code=502; return $this->_raiseError($msg, $code); - - } + if ($this->userExists($newUsername) ) { $msg=sprintf('the user "%s" already exists. choose another user name', $newUsername); $code=503; @@ -525,9 +528,6 @@ $this->deleteMailbox($oldUser); } - - - /** * Copies mail from one folder to another. * http://cvs.php.net/viewcvs.cgi/pear/Net_Cyrus/test_cyrus.php?r1=1.1&r2=1.2&diff_format=u Index: pear/Net_Cyrus/test_cyrus.php diff -u pear/Net_Cyrus/test_cyrus.php:1.1 pear/Net_Cyrus/test_cyrus.php:1.2 --- pear/Net_Cyrus/test_cyrus.php:1.1 Fri Apr 8 01:45:21 2005 +++ pear/Net_Cyrus/test_cyrus.php Wed Mar 22 04:02:54 2006 @@ -1,4 +1,4 @@ -<? +<?php // // +----------------------------------------------------------------------+ // | PHP Version 4 | @@ -27,7 +27,7 @@ */ -include_once('Net/Cyrus.php'); +require_once('Net/Cyrus.php'); //include_once('./Cyrus_horde.php'); error_reporting(E_ALL); @@ -107,7 +107,6 @@ echo "deleteUser('$user_to_create')\n"; if( PEAR::isError($res=$cyrus->deleteUser($user_to_create))){ echo "The user $user_to_create was NOT deleted. Reason:" . $res->getMessage() . "\n"; - }else{ echo "The user $user_to_create was deleted"; } @@ -117,7 +116,6 @@ echo "deleteUser('$user_to_create_new_name')\n"; if( PEAR::isError($res=$cyrus->deleteUser($user_to_create_new_name))){ echo "The user $user_to_create_new_name was NOT deleted. Reason:" . $res->getMessage() . "\n"; - }else{ echo "The user $user_to_create_new_name was deleted"; } @@ -135,7 +133,13 @@ } echo "\n"; - +echo "renameUser('$user_to_create','$user_to_create_new_name')\n"; +if( PEAR::isError($res=$cyrus->renameUser( $user_to_create, $user_to_create_new_name ) ) ){ + echo "The user $user_to_create was NOT renamed. Reason:" . $res->getMessage() . "\n"; +}else{ + echo "The user $user_to_create was renamed to $user_to_create_new_name"; +} +echo "\n"; @@ -167,5 +171,23 @@ echo "\n"; +// clean up +echo "deleteUser('$user_to_create')\n"; +if( PEAR::isError($res=$cyrus->deleteUser($user_to_create))){ + echo "The user $user_to_create was NOT deleted. Reason:" . $res->getMessage() . "\n"; +}else{ + echo "The user $user_to_create was deleted"; +} +echo "\n"; + +echo "deleteUser('$user_to_create_new_name')\n"; +if( PEAR::isError($res=$cyrus->deleteUser($user_to_create_new_name))){ + echo "The user $user_to_create_new_name was NOT deleted. Reason:" . $res->getMessage() . "\n"; +}else{ + echo "The user $user_to_create_new_name was deleted"; +} +echo "\n"; + + $cyrus->disconnect(); ?>

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