/**
 * Load the tests that are defined in the named modules.
 *
 * If you have Tests/Foo.php which defines a test class called
 * Tests_Foo, the call would look like:
 *
 * loadTests('Tests/', array('Foo'))
 *
 * @param string $test_dir The root of the test hierarchy. Must end
 * with a /
 *
 * @param array $test_names The names of the modules in which the
 * tests are defined. This should not include the root of the test
 * hierarchy.
 */
function loadTests($test_dir, $test_names)
{
    global $_tests;
    $suites = array();
    foreach ($test_names as $filename) {
        $filename = $test_dir . $filename . '.php';
        $class_name = str_replace('/', '_', $filename);
        $class_name = basename($class_name, '.php');
        if (!global_require_once($filename)) {
            continue;
        }
        $test = new $class_name($class_name);
        if (is_a($test, 'PHPUnit_TestCase')) {
            $s = new PHPUnit_TestSuite();
            $s->setName($class_name);
            $s->addTestSuite($class_name);
            $test = $s;
            $tc_array_name = $class_name . '_other';
            if (array_key_exists($tc_array_name, $GLOBALS) && is_array($GLOBALS[$tc_array_name])) {
                foreach ($GLOBALS[$tc_array_name] as $tc) {
                    $test->addTestSuite(get_class($tc));
                }
            }
        }
        $suites[] = $test;
    }
    return $suites;
}
示例#2
0
function makeSuite($class_name)
{
    $test = new $class_name($class_name);
    if (is_a($test, 'PHPUnit_TestCase')) {
        $s = new PHPUnit_TestSuite();
        $s->setName($class_name);
        $s->addTestSuite($class_name);
        $test = $s;
    }
    $tc_array_name = $class_name . '_other';
    if (array_key_exists($tc_array_name, $GLOBALS) && is_array($GLOBALS[$tc_array_name])) {
        foreach ($GLOBALS[$tc_array_name] as $tc) {
            $test->addTestSuite(get_class($tc));
        }
    }
    return $test;
}
        $user = new User();
        $user->first_name = 'Gaurav';
        $user->last_name = 'Bhatnagar';
        $user->homepage = 'http://www.newdelhitimes.org';
        $user->login_name = 'gaurav';
        $user->password = md5('password1');
        $user->email = '*****@*****.**';
        $user->save();
      }
      else {
        throw $e;
      }
    }

    $newuser = new User();
    $newuser->load('gaurav');
    $this->assertTrue($newuser->first_name == 'Gaurav');
    $newuser->delete();
    $this->assertTrue($newuser->is_active == FALSE);
  }
}

$suite = new PHPUnit_TestSuite();
$suite->addTest(new UserTestCase('testUserCRUD'));
$result = new PHPUnit_TestResult();
$suite->run($result);

print($result->toString());

?>
$suite->addTest(new ParsingBugsTests('testEncodeRecursive'));
$suite->addTest(new ParsingBugsTests('testBrokenrequests'));
$suite->addTest(new ParsingBugsTests('testBrokenresponses'));
$suite->addTest(new ParsingBugsTests('testBuggyHttp'));
$suite->addTest(new ParsingBugsTests('testStringBug'));
$suite->addTest(new ParsingBugsTests('testWhiteSpace'));
$suite->addTest(new ParsingBugsTests('testAutodecode'));
$suite->addTest(new ParsingBugsTests('testNoDecode'));
$suite->addTest(new ParsingBugsTests('testUTF8Response'));
$suite->addTest(new ParsingBugsTests('testUTF8Request'));
$suite->addTest(new ParsingBugsTests('testUTF8IntString'));
$suite->addTest(new ParsingBugsTests('testStringInt'));
$suite->addTest(new ParsingBugsTests('testStructMemExists'));
$title = 'XML-RPC Unit Tests';
if (isset($only)) {
    $suite = new PHPUnit_TestSuite($only);
}
if (isset($_SERVER['REQUEST_METHOD'])) {
    echo "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n<html xmlns=\"http://www.w3.org/1999/xhtml\" lang=\"en\" xml:lang=\"en\">\n<head>\n<title>{$title}</title>\n</head>\n<body>\n<h1>{$title}</h1>\n";
} else {
    echo "{$title}\n\n";
}
if (isset($_SERVER['REQUEST_METHOD'])) {
    echo "<h3>Using lib version: {$xmlrpcVersion} on PHP version: " . phpversion() . "</h3>\n";
    echo '<h3>Running ' . $suite->testCount() . ' tests (some of which are multiple) against servers: http://' . htmlspecialchars($LOCALSERVER . $URI) . ' and https://' . htmlspecialchars($HTTPSSERVER . $HTTPSURI) . "\n ...</h3>\n";
    flush();
} else {
    echo "Using lib version: {$xmlrpcVersion} on PHP version: " . phpversion() . "\n";
    echo 'Running ' . $suite->testCount() . ' tests (some of which are multiple) against servers: http://' . $LOCALSERVER . $URI . ' and https://' . $HTTPSSERVER . $HTTPSURI . "\n\n";
}
// do some basic timing measurement
示例#5
0
    function test_Contributor2()
    {
        $value = 'Joe Gregorio';
        $this->assertEquals($this->entry->contributor(1), $value);
    }
    function test_Content()
    {
        $value = '<p><i>[Update: The Atom draft is finished.]</i></p>';
        $content = trim(preg_replace('/\\t/', ' ', $this->entry->content));
        $content = preg_replace('/(\\s\\s)+/', ' ', $content);
        $this->assertEquals($value, $content);
    }
    function test_Link()
    {
        $value = 'http://example.org/2005/04/02/atom';
        $this->assertEquals($this->entry->link, $value);
    }
    function test_Enclosure()
    {
        $value = array('url' => 'http://example.org/audio/ph34r_my_podcast.mp3', 'type' => 'audio/mpeg', 'length' => '1337');
        $this->assertEquals($this->entry->enclosure, $value);
    }
    function test_entryXPath()
    {
        $this->assertEquals('http://example.org/2005/04/02/atom', $this->entry->link(0, 'href', array('rel' => 'alternate')));
    }
}
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite('XML_Feed_Parser_AtomEntryOnly_TestCase');
$result = PHPUnit::run($suite, '123');
echo $result->toString();
示例#6
0
文件: test.php 项目: Zunair/xataface
<?php

/**
 * Unit tests for Event_Dispatcher class
 * 
 * $Id: test.php,v 1.1.1.1 2005/11/29 19:21:53 sjhannah Exp $
 *
 * @package    Event_Dispatcher
 * @subpackage Tests
 */
require_once 'System.php';
require_once 'PHPUnit.php';
require_once 'Event/Dispatcher.php';
$testcases = array('Dispatcher_testcase');
$suite = new PHPUnit_TestSuite();
foreach ($testcases as $testcase) {
    include_once $testcase . '.php';
    $methods = preg_grep('/^test/i', get_class_methods($testcase));
    foreach ($methods as $method) {
        $suite->addTest(new $testcase($method));
    }
}
require_once './Console_TestListener.php';
$result = new PHPUnit_TestResult();
$result->addListener(new Console_TestListener());
$suite->run($result);
示例#7
0
include 'FileContainer.php';
include 'DBContainer.php';
include 'MDBContainer.php';
include 'POP3Container.php';
include 'POP3aContainer.php';
include 'IMAPContainer.php';
include_once 'PHPUnit.php';
function error($err)
{
    print "Error\n";
    print "Code:" . trim($err->getCode()) . "\n";
    print "Message:" . trim($err->getMessage()) . "\n";
    #print "UserInfo:".trim($err->getUserInfo())."\n";
    #print "DebugInfo:".trim($err->getDebugInfo())."\n";
}
#error_reporting(0);
#PEAR::setErrorHandling(PEAR_ERROR_PRINT, "\nPear Error:%s \n");
PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "error");
set_time_limit(0);
$suite = new PHPUnit_TestSuite();
// File Container
$suite->addTest(new PHPUnit_TestSuite('IMAPContaner'));
$suite->addTest(new PHPUnit_TestSuite('FileContaner'));
// DB Container
//$suite->addTest(new PHPUnit_TestSuite('DBContainer'));
// MDB Container
//$suite->addTest(new PHPUnit_TestSuite('MDBContainer'));
// POP3 Container
//$suite->addTest(new PHPUnit_TestSuite('POP3Container'));
$result = PHPUnit::run($suite);
echo $result->toString();
示例#8
0
    function __construct($name)
    {
        $this->PHPUnit_TestCase($name);
        $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
        $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'technorati.feed');
        $this->parser = new XML_Feed_Parser($this->file);
        $this->entry = $this->parser->getEntryByOffset(0);
    }
}
class XML_Feed_Parser_AtomCompat8_TestCase extends XML_Feed_Parser_AtomCompat1_TestCase
{
    function __construct($name)
    {
        $this->PHPUnit_TestCase($name);
        $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
        $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'grwifi-atom.xml');
        $this->parser = new XML_Feed_Parser($this->file);
        $this->entry = $this->parser->getEntryByOffset(0);
    }
}
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite('XML_Feed_Parser_AtomCompat1_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AtomCompat2_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AtomCompat3_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AtomCompat4_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AtomCompat5_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AtomCompat6_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AtomCompat7_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AtomCompat8_TestCase');
$result = PHPUnit::run($suite, '123');
echo $result->toString();
示例#9
0
    	$message2->delete();

    	$message->fetch();
    	$threadCount2 = $message->getNumMessagesInThread();

    	if ($threadCount != ($threadCount2 + 1)) {
    		$this->fail("Thread stats not updated correctly.");
    	}
    }
} // class PhorumMessage_test


class PhorumForum_test extends PHPUnit_TestCase
{

}

$suite  = new PHPUnit_TestSuite("PhorumUser_Test");
$suite->addTestSuite("PhorumMessage_Test");
$result = PHPUnit::run($suite);

echo $result->toHtml();

//$message = new Phorum_message(1);
//camp_dump($message);




?>
示例#10
0
文件: tests.php 项目: klofac/combros
include_once 'MDB2Container.php';
include_once 'POP3Container.php';
include_once 'POP3aContainer.php';
include_once 'IMAPContainer.php';
include_once 'PHPUnit.php';
function error($err)
{
    print "Error\n";
    print "Code:" . trim($err->getCode()) . "\n";
    print "Message:" . trim($err->getMessage()) . "\n";
    #print "UserInfo:".trim($err->getUserInfo())."\n";
    #print "DebugInfo:".trim($err->getDebugInfo())."\n";
}
#error_reporting(0);
PEAR::setErrorHandling(PEAR_ERROR_PRINT, "\nPear Error:%s \n");
#PEAR::setErrorHandling(PEAR_ERROR_CALLBACK, "error");
set_time_limit(0);
$suite = new PHPUnit_TestSuite();
// File Container
#$suite->addTest(new PHPUnit_TestSuite('IMAPContainer'));
$suite->addTest(new PHPUnit_TestSuite('FileContainer'));
$suite->addTest(new PHPUnit_TestSuite('DBContainer'));
//$suite->addTest(new PHPUnit_TestSuite('DBLiteContainer'));
// MDB Container
$suite->addTest(new PHPUnit_TestSuite('MDBContainer'));
// MDB2 Container
$suite->addTest(new PHPUnit_TestSuite('MDB2Container'));
// POP3 Container
$suite->addTest(new PHPUnit_TestSuite('POP3Container'));
$result = PHPUnit::run($suite);
echo $result->toString();
示例#11
0
fail</strong>.  Exactly those with <code>pass</code> in their name
should succeed.
</p>
<p>
For each test we display both the test result -- <span
class="Pass">ok</span>, <span class="Failure">FAIL</span>, or
<span class="Error">ERROR</span> -- and also a meta-result --
<span class="Expected">as expected</span>, <span
class="Unexpected">UNEXPECTED</span>, or <span
class="Unknown">unknown</span> -- that indicates whether the
expected test result occurred.  Although many test results will
be 'FAIL' here, all meta-results should be 'as expected', except
for a few 'unknown' meta-results (because of errors) when running
in PHP3.
</p>

<h2>Tests</h2>
<?php 
$testcases = array('HTML_Progress_TestCase_addListener', 'HTML_Progress_TestCase_DM_new', 'HTML_Progress_TestCase_DM_setIncrement', 'HTML_Progress_TestCase_DM_setMaximum', 'HTML_Progress_TestCase_DM_setMinimum', 'HTML_Progress_TestCase_DM_setValue', 'HTML_Progress_TestCase_getDM', 'HTML_Progress_TestCase_getString', 'HTML_Progress_TestCase_getUI', 'HTML_Progress_TestCase_removeListener', 'HTML_Progress_TestCase_setAnimSpeed', 'HTML_Progress_TestCase_setBorderPainted', 'HTML_Progress_TestCase_setDM', 'HTML_Progress_TestCase_setIndeterminate', 'HTML_Progress_TestCase_setModel', 'HTML_Progress_TestCase_setString', 'HTML_Progress_TestCase_setStringPainted', 'HTML_Progress_TestCase_setUI', 'HTML_Progress_TestCase_UI_getBorderAttributes', 'HTML_Progress_TestCase_UI_getCellAttributes', 'HTML_Progress_TestCase_UI_getProgressAttributes', 'HTML_Progress_TestCase_UI_getStringAttributes', 'HTML_Progress_TestCase_UI_new', 'HTML_Progress_TestCase_UI_setCellAttributes', 'HTML_Progress_TestCase_UI_setCellCoordinates', 'HTML_Progress_TestCase_UI_setCellCount', 'HTML_Progress_TestCase_UI_setFillWay', 'HTML_Progress_TestCase_UI_setOrientation', 'HTML_Progress_TestCase_UI_setScript');
$suite = new PHPUnit_TestSuite();
foreach ($testcases as $testcase) {
    include_once $testcase . '.php';
    $suite->addTestSuite($testcase);
}
$listener = new HTML_TestListener();
$result = TestUnit::run($suite, $listener);
$result->removeListener($listener);
$result->report();
?>
</body>
</html>
示例#12
0
// +-----------------------------------------------------------------------------+
// | Copyright (c) 2003 Sérgio Gonçalves Carvalho                                |
// +-----------------------------------------------------------------------------+
// | This file is part of Structures_Graph.                                      |
// |                                                                             |
// | Structures_Graph is free software; you can redistribute it and/or modify    |
// | it under the terms of the GNU Lesser General Public License as published by |
// | the Free Software Foundation; either version 2.1 of the License, or         |
// | (at your option) any later version.                                         |
// |                                                                             |
// | Structures_Graph is distributed in the hope that it will be useful,         |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of              |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the               |
// | GNU Lesser General Public License for more details.                         |
// |                                                                             |
// | You should have received a copy of the GNU Lesser General Public License    |
// | along with Structures_Graph; if not, write to the Free Software             |
// | Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA                    |
// | 02111-1307 USA                                                              |
// +-----------------------------------------------------------------------------+
// | Author: Sérgio Carvalho <*****@*****.**>                  |
// +-----------------------------------------------------------------------------+
//
// Place development Structures_Graph ahead in the include_path
ini_set('include_path', realpath(dirname(__FILE__) . "/..") . ":.:" . ini_get('include_path'));
require_once 'testCase/BasicGraph.php';
require_once 'PHPUnit.php';
$suite = new PHPUnit_TestSuite();
$suite->addTest(new PHPUnit_TestSuite('BasicGraph'));
$result = PHPUnit::run($suite);
echo $result->toString();
示例#13
0
<?php

// $Id: gui.php,v 1.2 2003/03/20 19:34:20 pukomuko Exp $
// naujas branch'as niu o mes einam toliau?
define('RELPATH', '../');
include '../site.header.php';
// Set the name of your testsuite class
$testName = "flexiUpdate3 tests";
// Set the path of your testsuite file
$testFile = "test_tpl.php";
require_once "PHPUnit/PHPUnit.php";
require_once 'dbtest.php';
require_once 'xmlinitests.php';
require_once 'sessiontest.php';
// run test
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite('dbtest');
$suite->addTestSuite('xmliniTest');
$suite->addTestSuite('sessionTest');
$result = PHPUnit::run($suite);
// do some calculations
$per = 100 / $result->runCount();
$notOkWidth = $per * $result->errorCount() + $per * $result->failureCount();
$okWidth = 100 - $notOkWidth;
?>

<html>
<head>
    <title>unitTests - flexiUpdate 3.0 pre0</title>
</head>
<body style="font-family:Verdana;"><center>
示例#14
0
<?php

$path = dirname(__FILE__) . '/../../../library/pear';
set_include_path(get_include_path() . PATH_SEPARATOR . $path);
$WHITE_SCREEN_OF_DEATH = false;
require_once dirname(__FILE__) . '/../../configs/conf.php';
require_once 'DB.php';
require_once 'PHPUnit.php';
require_once 'StoredFileTests.php';
require_once 'SchedulerTests.php';
//require_once 'SchedulerExportTests.php';
require_once 'PlaylistTests.php';
//$suite  = new PHPUnit_TestSuite("PlayListTests");
//$suite = new PHPUnit_TestSuite("SchedulerTests");
$suite = new PHPUnit_TestSuite("StoredFileTest");
$suite->addTestSuite("PlaylistTests");
$suite->addTestSuite("SchedulerTests");
//$suite->addTestSuite("SchedulerExportTests");
$result = PHPUnit::run($suite);
echo $result->toString();
示例#15
0
    }
    function test_entryAuthorEquivalence()
    {
        $value = "Simon St.Laurent (mailto:simonstl@simonstl.com)";
        $this->assertEquals($value, $this->entry->author);
    }
    function test_entryPublisher()
    {
        $value = "The O'Reilly Network";
        $this->assertEquals($value, $this->entry->publisher);
    }
    function test_entryCategory()
    {
        $value = "XML";
        $this->assertEquals($value, $this->entry->category);
    }
    function test_entryIdEquivalence()
    {
        $value = "http://c.moreover.com/click/here.pl?r123";
        $this->assertEquals($value, $this->entry->id);
    }
    function test_feedTextInput()
    {
        $value = array('title' => null, 'description' => null, 'name' => null, 'link' => "http://meerkat.oreillynet.com");
        $this->assertEquals($value, $this->feed->textinput);
    }
}
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite("XML_Feed_Parser_RSS1_valueValidity_TestCase");
$result = PHPUnit::run($suite, "123");
echo $result->toString();
示例#16
0
class pfcContainerTestcase_Mysql extends pfcContainerTestcase
{
    // constructor of the test suite
    function pfcContainerTestcase_Mysql($name)
    {
        $this->type = "Mysql";
        $this->pfcContainerTestcase($name);
    }
    // called before the test functions will be executed
    // this function is defined in PHPUnit_TestCase and overwritten
    // here
    function setUp()
    {
        pfcContainerTestcase::setUp();
    }
    // called after the test functions are executed
    // this function is defined in PHPUnit_TestCase and overwritten
    // here
    function tearDown()
    {
        pfcContainerTestcase::tearDown();
    }
}
// on desactive le timeout car se script peut mettre bcp de temps a s'executer
ini_set('max_execution_time', 0);
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite("pfcContainerTestcase_Mysql");
$result =& PHPUnit::run($suite);
echo "<pre>";
print_r($result->toString());
echo "</pre>";
示例#17
0
    }
    function tearDown()
    {
    }
    /**
     * Try to work with this ill-formed feed. If the tidy extension is not installed,
     * it expects parsing to fail. If tidy is installed and parsing fails, the test
     * fails. If tidy is installed and it parses, then the test passes.
     */
    function test_Tidy()
    {
        $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
        $file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . "illformed_atom10.xml");
        try {
            $feed = new XML_Feed_Parser($file, false, true, true);
        } catch (XML_Feed_Parser_Exception $e) {
            if (extension_loaded('tidy')) {
                $this->assertTrue(false);
            } else {
                $this->assertTrue(true);
            }
            return;
        }
        $entry = $feed->getEntryByOffset(0);
        $this->assertEquals($entry->author, 'Example author');
    }
}
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite("XML_Feed_Parser_Tidy_TestCase");
$result = PHPUnit::run($suite, "123");
echo $result->toString();
示例#18
0
    function __construct($name)
    {
        $this->PHPUnit_TestCase($name);
        $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
        $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'technorati.feed');
        $this->feed = new XML_Feed_Parser($this->file);
        $this->entry = $this->feed->getEntryByOffset(0);
    }
}
class XML_Feed_Parser_AccessTypes8_TestCase extends XML_Feed_Parser_AccessTypes1_TestCase
{
    function __construct($name)
    {
        $this->PHPUnit_TestCase($name);
        $sample_dir = XML_Feed_Parser_TestCase::getSampleDir();
        $this->file = file_get_contents($sample_dir . DIRECTORY_SEPARATOR . 'grwifi-atom.xml');
        $this->feed = new XML_Feed_Parser($this->file);
        $this->entry = $this->feed->getEntryByOffset(0);
    }
}
$suite = new PHPUnit_TestSuite();
$suite->addTestSuite('XML_Feed_Parser_AccessTypes1_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AccessTypes2_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AccessTypes3_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AccessTypes4_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AccessTypes5_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AccessTypes6_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AccessTypes7_TestCase');
$suite->addTestSuite('XML_Feed_Parser_AccessTypes8_TestCase');
$result = PHPUnit::run($suite, '123');
echo $result->toString();
示例#19
0
<?php

/********************************************************************************
 *
 *  Xataface Web Application Framework for PHP and MySQL
 *  Copyright (C) 2005  Steve Hannah <*****@*****.**>
 *  
 *  This library is free software; you can redistribute it and/or
 *  modify it under the terms of the GNU Lesser General Public
 *  License as published by the Free Software Foundation; either
 *  version 2.1 of the License, or (at your option) any later version.
 *  
 *  This library is distributed in the hope that it will be useful,
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 *  Lesser General Public License for more details.
 *  
 *  You should have received a copy of the GNU Lesser General Public
 *  License along with this library; if not, write to the Free Software
 *  Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 *
 *===============================================================================
 */
require_once 'Table_builderTest.php';
$test = new PHPUnit_TestSuite('Table_builderTest');
$result = new PHPUnit_TestResult();
//$result->addListener(new Benchmarker());
$test->run($result);
print $result->toHtml();
示例#20
0
        $this->_checkUseNonce($store, $nonce1, true, 2);
        $this->_checkUseNonce($store, $nonce1, false, 3);
        $this->_checkUseNonce($store, $nonce1, false, 4);
        // Storing twice has the same effect as storing once.
        $store->storeNonce($nonce1);
        $store->storeNonce($nonce1);
        $this->_checkUseNonce($store, $nonce1, true, 5);
        $this->_checkUseNonce($store, $nonce1, false, 6);
        $this->_checkUseNonce($store, $nonce1, false, 7);
        // Auth key functions
        // There is no key to start with, so generate a new key and
        // return it.
        $key = $store->getAuthKey();
        // The second time around should return the same as last time.
        $key2 = $store->getAuthKey();
        $this->assertEquals($key, $key2, "Auth keys differ");
        $this->assertEquals(strlen($key), $store->AUTH_KEY_LEN, "Key length not equals AUTH_KEY_LEN");
    }
    function testMemcStore()
    {
        # Unique prefix for this test
        $prefix = sprintf("test-%x", time());
        $store = new OpenID_MemcStore($prefix);
        $this->_testStore($store);
        $this->_testNonce($store);
    }
}
$suite = new PHPUnit_TestSuite();
$suite->addTest(new Tests_OpenID_MemcStore('testMemcStore'));
$result = PHPUnit::run($suite);
print $result->toString();