cvs: pear /Auth_PrefManager2/tests CommonTests.php runtests.php
| From: | Jon Wood | Date: | Wed, 07 Jul 2004 16:41:53 +0000 |
| Subject: | cvs: pear /Auth_PrefManager2/tests CommonTests.php runtests.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21603@lists.php.net to get a copy of this message | ||
jellybob Wed Jul 7 12:41:53 2004 EDT
Added files:
/pear/Auth_PrefManager2/tests CommonTests.php
Modified files:
/pear/Auth_PrefManager2/tests runtests.php
Log:
Added a test suite for basic usage.
http://cvs.php.net/diff.php/pear/Auth_PrefManager2/tests/runtests.php?r1=1.2&r2=1.3&ty=u
Index: pear/Auth_PrefManager2/tests/runtests.php
diff -u pear/Auth_PrefManager2/tests/runtests.php:1.2 pear/Auth_PrefManager2/tests/runtests.php:1.3
--- pear/Auth_PrefManager2/tests/runtests.php:1.2 Tue Jun 29 12:56:07 2004
+++ pear/Auth_PrefManager2/tests/runtests.php Wed Jul 7 12:41:53 2004
@@ -15,7 +15,7 @@
// | Paul M. Jones <pmjones@ciaweb.net> |
// +----------------------------------------------------------------------+
//
-// $Id: runtests.php,v 1.2 2004/06/29 16:56:07 jellybob Exp $
+// $Id: runtests.php,v 1.3 2004/07/07 16:41:53 jellybob Exp $
/**
* Auth_PrefManager2 test suite runner.
@@ -36,5 +36,6 @@
$test = &new GroupTest('All tests');
$test->addTestFile('CreationTests.php');
+$test->addTestFile('CommonTests.php');
$test->run(new TextReporter());
?>
http://cvs.php.net/co.php/pear/Auth_PrefManager2/tests/CommonTests.php?r=1.1&p=1
Index: pear/Auth_PrefManager2/tests/CommonTests.php
+++ pear/Auth_PrefManager2/tests/CommonTests.php
<?php
/* vim: set expandtab tabstop=4 shiftwidth=4 foldmethod=marker: */
// +----------------------------------------------------------------------+
// | Copyright (c) 2004 Jon Wood |
// +----------------------------------------------------------------------+
// | This source file is subject to version 2.02 of the PHP license, |
// | that is bundled with this package in the file LICENSE, and is |
// | available at through the world-wide-web at |
// | http://www.php.net/license/2_02.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. |
// +----------------------------------------------------------------------+
// | Authors: Jon Wood <jon@jellybob.co.uk> |
// | Paul M. Jones <pmjones@ciaweb.net> |
// +----------------------------------------------------------------------+
//
// $Id: CommonTests.php,v 1.1 2004/07/07 16:41:53 jellybob Exp $
/**
* Require Auth_PrefManager2 for testing.
*/
require_once('Auth/PrefManager2.php');
/**
* Test cases to ensure that the logic for returning default prefs if no
* specific ones are available.
*
* @author Jon Wood <jon@jellybob.co.uk>
* @package Auth_PrefManager2
* @version 0.1.0
*/
class CommonTests extends UnitTestCase
{
/**
* Constructor
*
* @access public
* @return void
*/
function CommonTests()
{
$this->UnitTestCase();
}
/**
* Test the setting and retrieval of a basic preference.
*
* @access public
* @return void
*/
function testUserPref()
{
$object =& Auth_PrefManager2::factory("Array");
$this->assertTrue($object->setPref('email', 'test@example.com',
'test'));
$this->assertEqual($object->getPref('email', 'test'),
'test@example.com');
}
/**
* Test the setting and retrieval of a default preference.
*
* @access public
* @return void
*/
function testDefaultPref()
{
$object =& Auth_PrefManager2::factory("Array");
$this->assertTrue($object->setPref('email', 'test@example.com'));
$this->assertEqual($object->getPref('email', 'test'),
'test@example.com');
}
/**
* Test the use of applications.
*
* @access public
* @return void
*/
function testApplicationPref()
{
$object =& Auth_PrefManager2::factory("Array");
$this->assertTrue($object->setPref('email', 'test@example.com',
'test'));
$this->assertTrue($object->setPref('email',
'test-lists@example.com', 'test', 'mailinglist'));
$this->assertEqual($object->getPref('email', 'test'),
'test@example.com');
$this->assertEqual($object->getPref('email', 'test',
'mailinglist'), 'test-lists@example.com');
}
}
?>