cvs: pear /Auth_PrefManager2/tests CreationTests.php runtests.php /Auth_PrefManager2/tests/support MockContainer.php
| From: | Jon Wood | Date: | Tue, 29 Jun 2004 16:56:07 +0000 |
| Subject: | cvs: pear /Auth_PrefManager2/tests CreationTests.php runtests.php /Auth_PrefManager2/tests/support MockContainer.php | ||
| Groups: | php.pear.cvs | ||
| Request: | Send a blank email to pear-cvs+get-21259@lists.php.net to get a copy of this message | ||
jellybob Tue Jun 29 12:56:07 2004 EDT
Added files:
/pear/Auth_PrefManager2/tests CreationTests.php
/pear/Auth_PrefManager2/tests/support MockContainer.php
Modified files:
/pear/Auth_PrefManager2/tests runtests.php
Log:
Added tests for the factory and singleton methods.
http://cvs.php.net/diff.php/pear/Auth_PrefManager2/tests/runtests.php?r1=1.1&r2=1.2&ty=u
Index: pear/Auth_PrefManager2/tests/runtests.php
diff -u pear/Auth_PrefManager2/tests/runtests.php:1.1 pear/Auth_PrefManager2/tests/runtests.php:1.2
--- pear/Auth_PrefManager2/tests/runtests.php:1.1 Tue Jun 29 11:23:53 2004
+++ pear/Auth_PrefManager2/tests/runtests.php Tue Jun 29 12:56:07 2004
@@ -15,11 +15,13 @@
// | Paul M. Jones <pmjones@ciaweb.net> |
// +----------------------------------------------------------------------+
//
-// $Id: runtests.php,v 1.1 2004/06/29 15:23:53 jellybob Exp $
+// $Id: runtests.php,v 1.2 2004/06/29 16:56:07 jellybob Exp $
/**
* Auth_PrefManager2 test suite runner.
* @author Jon Wood <jon@jellybob.co.uk>
+ * @package Auth_PrefManager2
+ * @version 0.1.0
*/
/**
@@ -33,6 +35,6 @@
require_once('simpletest/reporter.php');
$test = &new GroupTest('All tests');
-
+$test->addTestFile('CreationTests.php');
$test->run(new TextReporter());
?>
http://cvs.php.net/co.php/pear/Auth_PrefManager2/tests/CreationTests.php?r=1.1&p=1
Index: pear/Auth_PrefManager2/tests/CreationTests.php
+++ pear/Auth_PrefManager2/tests/CreationTests.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: CreationTests.php,v 1.1 2004/06/29 16:56:07 jellybob Exp $
/**
* Require Auth_PrefManager2 for testing.
*/
require_once('Auth/PrefManager2.php');
require_once('support/MockContainer.php');
/**
* Test cases to ensure that the factory and singleton methods work.
*
* @author Jon Wood <jon@jellybob.co.uk>
* @package Auth_PrefManager2
* @version 0.1.0
*/
class CreationTests extends UnitTestCase
{
/**
* Constructor
*
* @access public
* @return void
*/
function CreationTests()
{
$this->UnitTestCase();
}
/**
* Test the factory method.
*
* @access public
* @return void
* @todo Switch to using a full container once one is done.
*/
function testFactory()
{
$object =& Auth_PrefManager2::factory("Mock");
$this->assertIsA($object, "Auth_PrefManager2_Mock");
}
/**
* Test the factory method.
*
* @access public
* @return void
* @todo Switch to using a full container once one is done.
*/
function testSingleton()
{
$object =& Auth_PrefManager2::singleton("Mock");
$reference =& Auth_PrefManager2::singleton("Mock");
$this->assertReference($object, $reference);
}
}
?>
http://cvs.php.net/co.php/pear/Auth_PrefManager2/tests/support/MockContainer.php?r=1.1&p=1
Index: pear/Auth_PrefManager2/tests/support/MockContainer.php
+++ pear/Auth_PrefManager2/tests/support/MockContainer.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: MockContainer.php,v 1.1 2004/06/29 16:56:07 jellybob Exp $
/**
* Require the base class.
*/
require_once('Auth/PrefManager2.php');
/**
* A mock container for testing the factory and singleton methods.
*
* @author Jon Wood <jon@jellybob.co.uk>
* @package Auth_PrefManager2
* @category Authentication
* @version 0.1.0
*/
class Auth_PrefManager2_Mock extends Auth_PrefManager2
{
/**
* Constructor
*
* Applications should never call this constructor directly, instead
* create a container with the factory method.
*
* @access protected
* @param array $options An associative array of options.
* @return void
* @see Auth_PrefManager2::&factory()
*/
function Auth_PrefManager2_Mock($options = array())
{
$this->Auth_PrefManager2($options);
}
}
?>