diff options
Diffstat (limited to 'Tests')
-rw-r--r-- | Tests/Auth/OpenID/Association.php (renamed from Tests/Net/OpenID/Association.php) | 13 | ||||
-rw-r--r-- | Tests/Auth/OpenID/Consumer.php (renamed from Tests/Net/OpenID/Consumer.php) | 130 | ||||
-rw-r--r-- | Tests/Auth/OpenID/CryptUtil.php (renamed from Tests/Net/OpenID/CryptUtil.php) | 92 | ||||
-rw-r--r-- | Tests/Auth/OpenID/DiffieHellman.php (renamed from Tests/Net/OpenID/DiffieHellman.php) | 46 | ||||
-rw-r--r-- | Tests/Auth/OpenID/HMACSHA1.php (renamed from Tests/Net/OpenID/HMACSHA1.php) | 20 | ||||
-rw-r--r-- | Tests/Auth/OpenID/KVForm.php (renamed from Tests/Net/OpenID/KVForm.php) | 54 | ||||
-rw-r--r-- | Tests/Auth/OpenID/OIDUtil.php (renamed from Tests/Net/OpenID/OIDUtil.php) | 43 | ||||
-rw-r--r-- | Tests/Auth/OpenID/Parse.php (renamed from Tests/Net/OpenID/Parse.php) | 16 | ||||
-rw-r--r-- | Tests/Auth/OpenID/StoreTest.php (renamed from Tests/Net/OpenID/StoreTest.php) | 38 | ||||
-rw-r--r-- | Tests/Auth/OpenID/dhexch (renamed from Tests/Net/OpenID/dhexch) | 0 | ||||
-rw-r--r-- | Tests/Auth/OpenID/dhpriv (renamed from Tests/Net/OpenID/dhpriv) | 0 | ||||
-rw-r--r-- | Tests/Auth/OpenID/hmac.txt (renamed from Tests/Net/OpenID/hmac.txt) | 0 | ||||
-rw-r--r-- | Tests/Auth/OpenID/linkparse.txt (renamed from Tests/Net/OpenID/linkparse.txt) | 0 | ||||
-rw-r--r-- | Tests/TestDriver.php | 22 |
14 files changed, 238 insertions, 236 deletions
diff --git a/Tests/Net/OpenID/Association.php b/Tests/Auth/OpenID/Association.php index 8e547c2..d344a21 100644 --- a/Tests/Net/OpenID/Association.php +++ b/Tests/Auth/OpenID/Association.php @@ -14,18 +14,19 @@ */ require_once('PHPUnit.php'); -require_once('Net/OpenID/Association.php'); +require_once('Auth/OpenID/Association.php'); -class Tests_Net_OpenID_Association extends PHPUnit_TestCase { +class Tests_Auth_OpenID_Association extends PHPUnit_TestCase { function test_me() { $issued = time(); $lifetime = 600; - $assoc = new Net_OpenID_Association('handle', 'secret', $issued, + $assoc = new Auth_OpenID_Association('handle', 'secret', $issued, $lifetime, 'HMAC-SHA1'); $s = $assoc->serialize(); - $assoc2 = Net_OpenID_Association::deserialize('Net_OpenID_Association', - $s); + $assoc2 = Auth_OpenID_Association::deserialize( + 'Auth_OpenID_Association', $s); + if ($assoc2 === null) { $this->fail('deserialize returned null'); } else { @@ -34,4 +35,4 @@ class Tests_Net_OpenID_Association extends PHPUnit_TestCase { } } -?>
\ No newline at end of file +?> diff --git a/Tests/Net/OpenID/Consumer.php b/Tests/Auth/OpenID/Consumer.php index 5937143..955558d 100644 --- a/Tests/Net/OpenID/Consumer.php +++ b/Tests/Auth/OpenID/Consumer.php @@ -13,21 +13,21 @@ * @license http://www.gnu.org/copyleft/lesser.html LGPL */ -require_once('Net/OpenID/CryptUtil.php'); -require_once('Net/OpenID/DiffieHellman.php'); -require_once('Net/OpenID/Store/FileStore.php'); -require_once('Net/OpenID/OIDUtil.php'); -require_once('Net/OpenID/KVForm.php'); -require_once('Net/OpenID/Consumer/Consumer.php'); - -$_Net_OpenID_assocs = array( +require_once('Auth/OpenID/CryptUtil.php'); +require_once('Auth/OpenID/DiffieHellman.php'); +require_once('Auth/OpenID/Store/FileStore.php'); +require_once('Auth/OpenID/OIDUtil.php'); +require_once('Auth/OpenID/KVForm.php'); +require_once('Auth/OpenID/Consumer/Consumer.php'); + +$_Auth_OpenID_assocs = array( array('another 20-byte key.', 'Snarky'), array(str_repeat("\x00", 20), 'Zeros'), ); -$_Net_OpenID_filestore_base_dir = "/tmp"; +$_Auth_OpenID_filestore_base_dir = "/tmp"; -function Net_OpenID_parse($qs) +function Auth_OpenID_parse($qs) { $result = array(); $parts = explode("&", $qs); @@ -39,22 +39,22 @@ function Net_OpenID_parse($qs) return $result; } -function Net_OpenID_associate($qs, $assoc_secret, $assoc_handle) +function Auth_OpenID_associate($qs, $assoc_secret, $assoc_handle) { - $query_data = Net_OpenID_parse($qs); + $query_data = Auth_OpenID_parse($qs); assert((count($query_data) == 6) || (count($query_data) == 4)); assert($query_data['openid.mode'] == 'associate'); assert($query_data['openid.assoc_type'] == 'HMAC-SHA1'); assert($query_data['openid.session_type'] == 'DH-SHA1'); - $d = Net_OpenID_DiffieHellman::fromBase64( - Net_OpenID_array_get($query_data, 'openid.dh_modulus', null), - Net_OpenID_array_get($query_data, 'openid.dh_gen', null)); + $d = Auth_OpenID_DiffieHellman::fromBase64( + Auth_OpenID_array_get($query_data, 'openid.dh_modulus', null), + Auth_OpenID_array_get($query_data, 'openid.dh_gen', null)); - $composite = Net_OpenID_CryptUtil::base64ToLong( + $composite = Auth_OpenID_CryptUtil::base64ToLong( $query_data['openid.dh_consumer_public']); - $enc_mac_key = Net_OpenID_CryptUtil::toBase64( + $enc_mac_key = Auth_OpenID_CryptUtil::toBase64( $d->xorSecret($composite, $assoc_secret)); $reply_dict = array( @@ -63,15 +63,15 @@ function Net_OpenID_associate($qs, $assoc_secret, $assoc_handle) 'expires_in' => '600', 'session_type' => 'DH-SHA1', 'dh_server_public' => - Net_OpenID_CryptUtil::longToBase64($d->public), + Auth_OpenID_CryptUtil::longToBase64($d->public), 'enc_mac_key' => $enc_mac_key, ); - return Net_OpenID_KVForm::arrayToKV($reply_dict); + return Auth_OpenID_KVForm::arrayToKV($reply_dict); } -class Net_OpenID_TestFetcher { - function Net_OpenID_TestFetcher($user_url, $user_page, +class Auth_OpenID_TestFetcher { + function Auth_OpenID_TestFetcher($user_url, $user_page, $assoc_secret, $assoc_handle) { $this->get_responses = array($user_url => array(200, @@ -103,7 +103,7 @@ class Net_OpenID_TestFetcher { function post($url, $body) { if (strpos($body, 'openid.mode=associate') !== false) { - $response = Net_OpenID_associate($body, $this->assoc_secret, + $response = Auth_OpenID_associate($body, $this->assoc_secret, $this->assoc_handle); $this->num_assocs++; return $this->response($url, $response); @@ -113,7 +113,7 @@ class Net_OpenID_TestFetcher { } } -$_Net_OpenID_user_page_pat = "<html> +$_Auth_OpenID_user_page_pat = "<html> <head> <title>A user page</title> %s @@ -123,29 +123,29 @@ $_Net_OpenID_user_page_pat = "<html> </body> </html>"; -$_Net_OpenID_server_url = "http://server.example.com/"; -$_Net_OpenID_consumer_url = "http://consumer.example.com/"; +$_Auth_OpenID_server_url = "http://server.example.com/"; +$_Auth_OpenID_consumer_url = "http://consumer.example.com/"; -class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { +class Tests_Auth_OpenID_Consumer extends PHPUnit_TestCase { function _run(&$consumer, $user_url, $mode, $delegate_url, &$fetcher, &$store) { - global $Net_OpenID_SUCCESS, - $_Net_OpenID_consumer_url, - $_Net_OpenID_server_url; + global $Auth_OpenID_SUCCESS, + $_Auth_OpenID_consumer_url, + $_Auth_OpenID_server_url; list($status, $info) = $consumer->beginAuth($user_url); - $this->assertEquals($status, $Net_OpenID_SUCCESS); + $this->assertEquals($status, $Auth_OpenID_SUCCESS); - $return_to = $_Net_OpenID_consumer_url; - $trust_root = $_Net_OpenID_consumer_url; + $return_to = $_Auth_OpenID_consumer_url; + $trust_root = $_Auth_OpenID_consumer_url; $redirect_url = $consumer->constructRedirect($info, $return_to, $trust_root); $parsed = parse_url($redirect_url); $qs = $parsed['query']; - $q = Net_OpenID_parse($qs); + $q = Auth_OpenID_parse($qs); $this->assertEquals($q, array( 'openid.mode' => $mode, @@ -156,7 +156,7 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { 'openid.return_to' => $return_to )); - $this->assertEquals(strpos($redirect_url, $_Net_OpenID_server_url), + $this->assertEquals(strpos($redirect_url, $_Auth_OpenID_server_url), 0); $query = array( @@ -166,26 +166,26 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { 'openid.assoc_handle'=> $fetcher->assoc_handle, ); - $assoc = $store->getAssociation($_Net_OpenID_server_url, + $assoc = $store->getAssociation($_Auth_OpenID_server_url, $fetcher->assoc_handle); $assoc->addSignature(array('mode', 'return_to', 'identity'), $query); list($status, $info) = $consumer->completeAuth($info->token, $query); - $this->assertEquals($status, $Net_OpenID_SUCCESS); + $this->assertEquals($status, $Auth_OpenID_SUCCESS); $this->assertEquals($info, $user_url); } function _test_success($user_url, $delegate_url, $links, $immediate = false) { - global $_Net_OpenID_filestore_base_dir, - $_Net_OpenID_server_url, - $_Net_OpenID_user_page_pat, - $_Net_OpenID_assocs; + global $_Auth_OpenID_filestore_base_dir, + $_Auth_OpenID_server_url, + $_Auth_OpenID_user_page_pat, + $_Auth_OpenID_assocs; - $store = new Net_OpenID_FileStore( - Net_OpenID_mkdtemp($_Net_OpenID_filestore_base_dir)); + $store = new Auth_OpenID_FileStore( + Auth_OpenID_mkdtemp($_Auth_OpenID_filestore_base_dir)); if ($immediate) { $mode = 'checkid_immediate'; @@ -193,12 +193,12 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { $mode = 'checkid_setup'; } - $user_page = sprintf($_Net_OpenID_user_page_pat, $links); - $fetcher = new Net_OpenID_TestFetcher($user_url, $user_page, - $_Net_OpenID_assocs[0][0], - $_Net_OpenID_assocs[0][1]); + $user_page = sprintf($_Auth_OpenID_user_page_pat, $links); + $fetcher = new Auth_OpenID_TestFetcher($user_url, $user_page, + $_Auth_OpenID_assocs[0][0], + $_Auth_OpenID_assocs[0][1]); - $consumer = new Net_OpenID_Consumer($store, &$fetcher, $immediate); + $consumer = new Auth_OpenID_Consumer($store, &$fetcher, $immediate); $this->assertEquals($fetcher->num_assocs, 0); $this->_run($consumer, $user_url, $mode, $delegate_url, @@ -213,7 +213,7 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { $this->assertEquals($fetcher->num_assocs, 1); // Another association is created if we remove the existing one - $store->removeAssociation($_Net_OpenID_server_url, + $store->removeAssociation($_Auth_OpenID_server_url, $fetcher->assoc_handle); $this->_run($consumer, $user_url, $mode, $delegate_url, @@ -232,16 +232,16 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { function test_success() { - global $_Net_OpenID_server_url; + global $_Auth_OpenID_server_url; $user_url = 'http://www.example.com/user.html'; $links = sprintf('<link rel="openid.server" href="%s" />', - $_Net_OpenID_server_url); + $_Auth_OpenID_server_url); $delegate_url = 'http://consumer.example.com/user'; $delegate_links = sprintf('<link rel="openid.server" href="%s" />'. '<link rel="openid.delegate" href="%s" />', - $_Net_OpenID_server_url, $delegate_url); + $_Auth_OpenID_server_url, $delegate_url); $this->_test_success($user_url, $user_url, $links); $this->_test_success($user_url, $user_url, $links, true); @@ -251,14 +251,14 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { function test_bad_fetch() { - global $_Net_OpenID_filestore_base_dir, - $Net_OpenID_HTTP_FAILURE; + global $_Auth_OpenID_filestore_base_dir, + $Auth_OpenID_HTTP_FAILURE; - $store = new Net_OpenID_FileStore( - Net_OpenID_mkdtemp($_Net_OpenID_filestore_base_dir)); + $store = new Auth_OpenID_FileStore( + Auth_OpenID_mkdtemp($_Auth_OpenID_filestore_base_dir)); - $fetcher = new Net_OpenID_TestFetcher(null, null, null, null); - $consumer = new Net_OpenID_Consumer($store, &$fetcher); + $fetcher = new Auth_OpenID_TestFetcher(null, null, null, null); + $consumer = new Auth_OpenID_Consumer($store, &$fetcher); $cases = array( array(null, 'http://network.error/'), array(404, 'http://not.found/'), @@ -270,7 +270,7 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { list($error_code, $url) = $case; $fetcher->get_responses[$url] = array($error_code, $url, null); list($status, $info) = $consumer->beginAuth($url); - $this->assertEquals($status, $Net_OpenID_HTTP_FAILURE); + $this->assertEquals($status, $Auth_OpenID_HTTP_FAILURE); $this->assertEquals($info, $error_code); } @@ -279,11 +279,11 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { function test_bad_parse() { - global $_Net_OpenID_filestore_base_dir, - $Net_OpenID_PARSE_ERROR; + global $_Auth_OpenID_filestore_base_dir, + $Auth_OpenID_PARSE_ERROR; - $store = new Net_OpenID_FileStore( - Net_OpenID_mkdtemp($_Net_OpenID_filestore_base_dir)); + $store = new Auth_OpenID_FileStore( + Auth_OpenID_mkdtemp($_Auth_OpenID_filestore_base_dir)); $user_url = 'http://user.example.com/'; $cases = array( @@ -293,11 +293,11 @@ class Tests_Net_OpenID_Consumer extends PHPUnit_TestCase { ); foreach ($cases as $user_page) { - $fetcher = new Net_OpenID_TestFetcher($user_url, $user_page, + $fetcher = new Auth_OpenID_TestFetcher($user_url, $user_page, null, null); - $consumer = new Net_OpenID_Consumer($store, $fetcher); + $consumer = new Auth_OpenID_Consumer($store, $fetcher); list($status, $info) = $consumer->beginAuth($user_url); - $this->assertEquals($status, $Net_OpenID_PARSE_ERROR); + $this->assertEquals($status, $Auth_OpenID_PARSE_ERROR); $this->assertNull($info); } diff --git a/Tests/Net/OpenID/CryptUtil.php b/Tests/Auth/OpenID/CryptUtil.php index 33e500a..cb8dba1 100644 --- a/Tests/Net/OpenID/CryptUtil.php +++ b/Tests/Auth/OpenID/CryptUtil.php @@ -14,14 +14,14 @@ */ require_once('PHPUnit.php'); -require_once('Net/OpenID/CryptUtil.php'); +require_once('Auth/OpenID/CryptUtil.php'); -class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase { +class Tests_Auth_OpenID_ByteOps extends PHPUnit_TestCase { function test_length() { $cases = array(1, 10, 255); foreach ($cases as $length) { - $data = Net_OpenID_CryptUtil::getBytes($length); + $data = Auth_OpenID_CryptUtil::getBytes($length); $this->assertEquals(strlen($data), $length); } } @@ -31,10 +31,10 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase { $num_iterations = 100; $data_length = 20; - $data = Net_OpenID_CryptUtil::getBytes($num_iterations); + $data = Auth_OpenID_CryptUtil::getBytes($num_iterations); for ($i = 0; $i < $num_iterations; $i++) { $last = $data; - $data = Net_OpenID_CryptUtil::getBytes($num_iterations); + $data = Auth_OpenID_CryptUtil::getBytes($num_iterations); $this->assertFalse($data == $last); } } @@ -44,8 +44,8 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase { // It's possible, but HIGHLY unlikely that a correct // implementation will fail by returning the same number twice - $s = Net_OpenID_CryptUtil::getBytes(32); - $t = Net_OpenID_CryptUtil::getBytes(32); + $s = Auth_OpenID_CryptUtil::getBytes(32); + $t = Auth_OpenID_CryptUtil::getBytes(32); $this->assertEquals(strlen($s), 32); $this->assertEquals(strlen($t), 32); $this->assertFalse($s == $t); @@ -71,7 +71,7 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase { while (list($index, $values) = each($cases)) { list($aa, $bb, $expected) = $values; - $actual = Net_OpenID_CryptUtil::strxor($aa, $bb); + $actual = Auth_OpenID_CryptUtil::strxor($aa, $bb); $this->assertEquals($actual, $expected); } @@ -88,7 +88,7 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase { while(list($index, $values) = each($exc_cases)) { list($aa, $bb) = $values; - $unexpected = Net_OpenID_CryptUtil::strxor($aa, $bb); + $unexpected = Auth_OpenID_CryptUtil::strxor($aa, $bb); $this->assertNull($unexpected); } } @@ -110,19 +110,19 @@ class Tests_Net_OpenID_ByteOps extends PHPUnit_TestCase { while (list($index, $values) = each($cases)) { list($case, $expected) = $values; - $actual = Net_OpenID_CryptUtil::reversed($case); + $actual = Auth_OpenID_CryptUtil::reversed($case); $this->assertEquals($actual, $expected); - $twice = Net_OpenID_CryptUtil::reversed($actual); + $twice = Auth_OpenID_CryptUtil::reversed($actual); $this->assertEquals($twice, $case); } } } -class Tests_Net_OpenID_BinLongConvertRnd extends PHPUnit_TestCase { +class Tests_Auth_OpenID_BinLongConvertRnd extends PHPUnit_TestCase { var $lib; var $max; - function Tests_Net_OpenID_BinLongConvertRnd(&$lib, $max) + function Tests_Auth_OpenID_BinLongConvertRnd(&$lib, $max) { $this->lib =& $lib; $this->max = $max; @@ -132,22 +132,22 @@ class Tests_Net_OpenID_BinLongConvertRnd extends PHPUnit_TestCase { { $n = $this->lib->init(0); foreach (range(0, 9) as $i) { - $rnd = Net_OpenID_CryptUtil::randrange($this->max); + $rnd = Auth_OpenID_CryptUtil::randrange($this->max); $n = $this->lib->add($n, $rnd); } - $s = Net_OpenID_CryptUtil::longToBinary($n); + $s = Auth_OpenID_CryptUtil::longToBinary($n); $this->assertTrue(is_string($s)); - $n_prime = Net_OpenID_CryptUtil::binaryToLong($s); + $n_prime = Auth_OpenID_CryptUtil::binaryToLong($s); $this->assertEquals($this->lib->cmp($n, $n_prime), 0); } } -class Tests_Net_OpenID_BinLongConvert extends PHPUnit_TestCase { +class Tests_Auth_OpenID_BinLongConvert extends PHPUnit_TestCase { var $lib; var $bin; var $lng; - function Tests_Net_OpenID_BinLongConvert(&$lib, $bin, $lng) + function Tests_Auth_OpenID_BinLongConvert(&$lib, $bin, $lng) { $this->lib =& $lib; $this->bin = $bin; @@ -156,19 +156,19 @@ class Tests_Net_OpenID_BinLongConvert extends PHPUnit_TestCase { function runTest() { - $n_prime = Net_OpenID_CryptUtil::binaryToLong($this->bin); - $s_prime = Net_OpenID_CryptUtil::longToBinary($this->lng); + $n_prime = Auth_OpenID_CryptUtil::binaryToLong($this->bin); + $s_prime = Auth_OpenID_CryptUtil::longToBinary($this->lng); $this->assertEquals($this->lib->cmp($this->lng, $n_prime), 0); $this->assertTrue($this->bin == $s_prime); } } -class Tests_Net_OpenID_Base64ToLong extends PHPUnit_TestCase { +class Tests_Auth_OpenID_Base64ToLong extends PHPUnit_TestCase { var $num; var $b64; var $lib; - function Tests_Net_OpenID_Base64ToLong(&$lib, $b64, $num) + function Tests_Auth_OpenID_Base64ToLong(&$lib, $b64, $num) { $this->lib = $lib; $this->b64 = $b64; @@ -177,13 +177,13 @@ class Tests_Net_OpenID_Base64ToLong extends PHPUnit_TestCase { function runTest() { - $actual = Net_OpenID_CryptUtil::base64ToLong($this->b64); + $actual = Auth_OpenID_CryptUtil::base64ToLong($this->b64); $this->assertTrue($this->lib->cmp($this->num, $actual) == 0); } } -class Tests_Net_OpenID_LongToBase64 extends Tests_Net_OpenID_Base64ToLong { - function Tests_Net_OpenID_LongToBase64(&$lib, $b64, $num) +class Tests_Auth_OpenID_LongToBase64 extends Tests_Auth_OpenID_Base64ToLong { + function Tests_Auth_OpenID_LongToBase64(&$lib, $b64, $num) { $this->lib = $lib; $this->b64 = $b64; @@ -192,13 +192,13 @@ class Tests_Net_OpenID_LongToBase64 extends Tests_Net_OpenID_Base64ToLong { function runTest() { - $actual = Net_OpenID_CryptUtil::longToBase64($this->num); + $actual = Auth_OpenID_CryptUtil::longToBase64($this->num); $this->assertEquals($this->b64, $actual); } } -class Tests_Net_OpenID_RandRange extends PHPUnit_TestCase { - function Tests_Net_OpenID_RandRange(&$lib) +class Tests_Auth_OpenID_RandRange extends PHPUnit_TestCase { + function Tests_Auth_OpenID_RandRange(&$lib) { $this->lib =& $lib; } @@ -206,23 +206,23 @@ class Tests_Net_OpenID_RandRange extends PHPUnit_TestCase { function runTest() { $stop = $this->lib->pow(2, 128); - $a = Net_OpenID_CryptUtil::randrange($stop); - $b = Net_OpenID_CryptUtil::randrange($stop); + $a = Auth_OpenID_CryptUtil::randrange($stop); + $b = Auth_OpenID_CryptUtil::randrange($stop); $this->assertFalse($this->lib->cmp($b, $a) == 0, "Same: $a $b"); - $n = $this->lib->init(Net_OpenID_CryptUtil::maxint()); + $n = $this->lib->init(Auth_OpenID_CryptUtil::maxint()); $n = $this->lib->add($n, 1); // Make sure that we can generate random numbers that are // larger than platform int size - $result = Net_OpenID_CryptUtil::randrange($n); + $result = Auth_OpenID_CryptUtil::randrange($n); // What can we say about the result? } } -class Tests_Net_OpenID_CryptUtil extends PHPUnit_TestSuite { +class Tests_Auth_OpenID_CryptUtil extends PHPUnit_TestSuite { function _parseBase64Data() { $lines = file_get_contents('Tests/n2b64', true); @@ -239,19 +239,19 @@ class Tests_Net_OpenID_CryptUtil extends PHPUnit_TestSuite { return $data; } - function Tests_Net_OpenID_CryptUtil($name) + function Tests_Auth_OpenID_CryptUtil($name) { $this->setName($name); - if (!defined('Net_OpenID_NO_MATH_SUPPORT')) { - $this->addTestSuite('Tests_Net_OpenID_BigInt'); + if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) { + $this->addTestSuite('Tests_Auth_OpenID_BigInt'); - $lib =& Net_OpenID_MathLibrary::getLibWrapper(); - $max = Net_OpenID_CryptUtil::maxint(); - $upper = defined('Tests_Net_OpenID_thorough') ? 499 : 3; + $lib =& Auth_OpenID_MathLibrary::getLibWrapper(); + $max = Auth_OpenID_CryptUtil::maxint(); + $upper = defined('Tests_Auth_OpenID_thorough') ? 499 : 3; foreach (range(0, $upper) as $iteration) { - $test = new Tests_Net_OpenID_BinLongConvertRnd($lib, $max); + $test = new Tests_Auth_OpenID_BinLongConvertRnd($lib, $max); $test->setName("BinLongConvertRnd " . strval($iteration)); $this->addTest($test); } @@ -268,12 +268,12 @@ class Tests_Net_OpenID_CryptUtil extends PHPUnit_TestSuite { foreach ($cases as $bin => $lng_m) { $lng = $lib->init($lng_m); - $test = new Tests_Net_OpenID_BinLongConvert($lib, $bin, $lng); + $test = new Tests_Auth_OpenID_BinLongConvert($lib, $bin, $lng); $test->setName('BinLongConvert ' . bin2hex($bin)); $this->addTest($test); } - $count = defined('Tests_Net_OpenID_thorough') ? -1 : 2; + $count = defined('Tests_Auth_OpenID_thorough') ? -1 : 2; $data = $this->_parseBase64Data(); foreach ($data as $b64 => $num_s) { // Only test the first few unless thorough is defined @@ -285,21 +285,21 @@ class Tests_Net_OpenID_CryptUtil extends PHPUnit_TestSuite { } } $num = $lib->init($num_s); - $test = new Tests_Net_OpenID_Base64ToLong($lib, $b64, $num); + $test = new Tests_Auth_OpenID_Base64ToLong($lib, $b64, $num); $test->setName("B64->Long $num_s"); $this->addTest($test); - $test = new Tests_Net_OpenID_LongToBase64($lib, $b64, $num); + $test = new Tests_Auth_OpenID_LongToBase64($lib, $b64, $num); $test->setName("Long->B64 $num_s"); $this->addTest($test); } - $test = new Tests_Net_OpenID_RandRange($lib); + $test = new Tests_Auth_OpenID_RandRange($lib); $test->setName('Big number randrange'); $this->addTest($test); } - $this->addTestSuite('Tests_Net_OpenID_ByteOps'); + $this->addTestSuite('Tests_Auth_OpenID_ByteOps'); } } diff --git a/Tests/Net/OpenID/DiffieHellman.php b/Tests/Auth/OpenID/DiffieHellman.php index 043ef85..9f6cd1a 100644 --- a/Tests/Net/OpenID/DiffieHellman.php +++ b/Tests/Auth/OpenID/DiffieHellman.php @@ -15,10 +15,10 @@ */ require_once('PHPUnit.php'); -require_once('Net/OpenID/DiffieHellman.php'); +require_once('Auth/OpenID/DiffieHellman.php'); -class Tests_Net_OpenID_DiffieHellman_CheckCases extends PHPUnit_TestCase { - function Tests_Net_OpenID_DiffieHellman_CheckCases($cases, $n) +class Tests_Auth_OpenID_DiffieHellman_CheckCases extends PHPUnit_TestCase { + function Tests_Auth_OpenID_DiffieHellman_CheckCases($cases, $n) { $this->cases = $cases; $this->n = $n; @@ -30,8 +30,8 @@ class Tests_Net_OpenID_DiffieHellman_CheckCases extends PHPUnit_TestCase { } } -class Tests_Net_OpenID_DiffieHellman_Private extends PHPUnit_TestCase { - function Tests_Net_OpenID_DiffieHellman_Private($name, $input, $expected) +class Tests_Auth_OpenID_DiffieHellman_Private extends PHPUnit_TestCase { + function Tests_Auth_OpenID_DiffieHellman_Private($name, $input, $expected) { $this->setName("$name"); $this->input = $input; @@ -40,13 +40,13 @@ class Tests_Net_OpenID_DiffieHellman_Private extends PHPUnit_TestCase { function runTest() { - $dh = new Net_OpenID_DiffieHellman(null, null, $this->input); + $dh = new Auth_OpenID_DiffieHellman(null, null, $this->input); $this->assertEquals($this->expected, $dh->getPublicKey()); } } -class Tests_Net_OpenID_DiffieHellman_Exch extends PHPUnit_TestCase { - function Tests_Net_OpenID_DiffieHellman_Exch($name, $p1, $p2, $shared) +class Tests_Auth_OpenID_DiffieHellman_Exch extends PHPUnit_TestCase { + function Tests_Auth_OpenID_DiffieHellman_Exch($name, $p1, $p2, $shared) { $this->setName("$name"); $this->p1 = $p1; @@ -56,10 +56,10 @@ class Tests_Net_OpenID_DiffieHellman_Exch extends PHPUnit_TestCase { function runTest() { - $lib =& Net_OpenID_MathLibrary::getLibWrapper(); + $lib =& Auth_OpenID_MathLibrary::getLibWrapper(); $shared = $lib->init($this->shared); - $dh1 = new Net_OpenID_DiffieHellman(null, null, $this->p1); - $dh2 = new Net_OpenID_DiffieHellman(null, null, $this->p2); + $dh1 = new Auth_OpenID_DiffieHellman(null, null, $this->p1); + $dh2 = new Auth_OpenID_DiffieHellman(null, null, $this->p2); $sh1 = $dh1->getSharedSecret($dh2->getPublicKey()); $sh2 = $dh2->getSharedSecret($dh1->getPublicKey()); $this->assertEquals($lib->cmp($shared, $sh1), 0); @@ -67,7 +67,7 @@ class Tests_Net_OpenID_DiffieHellman_Exch extends PHPUnit_TestCase { } } -class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite { +class Tests_Auth_OpenID_DiffieHellman extends PHPUnit_TestSuite { function _getLines($base) { $path = dirname(realpath(__FILE__)); @@ -82,7 +82,7 @@ class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite { function _readPrivateTestCases() { - $lines = Tests_Net_OpenID_DiffieHellman::_getLines('dhpriv'); + $lines = Tests_Auth_OpenID_DiffieHellman::_getLines('dhpriv'); $cases = array(); foreach ($lines as $line) { $case = array(); @@ -105,7 +105,7 @@ class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite { function _readExchTestCases() { - $lines = Tests_Net_OpenID_DiffieHellman::_getLines('dhexch'); + $lines = Tests_Auth_OpenID_DiffieHellman::_getLines('dhexch'); $cases = array(); foreach ($lines as $line) { $case = array(); @@ -125,24 +125,24 @@ class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite { return $cases; } - function Tests_Net_OpenID_DiffieHellman($name) + function Tests_Auth_OpenID_DiffieHellman($name) { $this->setName($name); - $priv_cases = Tests_Net_OpenID_DiffieHellman::_readPrivateTestCases(); - $sanity = new Tests_Net_OpenID_DiffieHellman_CheckCases( + $priv_cases = Tests_Auth_OpenID_DiffieHellman::_readPrivateTestCases(); + $sanity = new Tests_Auth_OpenID_DiffieHellman_CheckCases( $priv_cases, 29); $sanity->setName('Check parsing of priv test data'); $this->addTest($sanity); - $exch_cases = Tests_Net_OpenID_DiffieHellman::_readExchTestCases(); - $sanity = new Tests_Net_OpenID_DiffieHellman_CheckCases( + $exch_cases = Tests_Auth_OpenID_DiffieHellman::_readExchTestCases(); + $sanity = new Tests_Auth_OpenID_DiffieHellman_CheckCases( $exch_cases, 25); $sanity->setName('Check parsing of exch test data'); $this->addTest($sanity); - if (!defined('Net_OpenID_NO_MATH_SUPPORT')) { - if (defined('Tests_Net_OpenID_thorough')) { + if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) { + if (defined('Tests_Auth_OpenID_thorough')) { $npriv = count($priv_cases); $nexch = count($exch_cases); } else { @@ -152,14 +152,14 @@ class Tests_Net_OpenID_DiffieHellman extends PHPUnit_TestSuite { for ($i = 0; $i < $npriv; $i++) { $case = $priv_cases[$i]; - $one = new Tests_Net_OpenID_DiffieHellman_Private( + $one = new Tests_Auth_OpenID_DiffieHellman_Private( $i, $case[0], $case[1]); $this->addTest($one); } for ($i = 0; $i < $nexch; $i++) { $case = $exch_cases[$i]; - $one = new Tests_Net_OpenID_DiffieHellman_Exch( + $one = new Tests_Auth_OpenID_DiffieHellman_Exch( $i, $case[0], $case[1], $case[2]); $this->addTest($one); } diff --git a/Tests/Net/OpenID/HMACSHA1.php b/Tests/Auth/OpenID/HMACSHA1.php index a184078..00b6b6c 100644 --- a/Tests/Net/OpenID/HMACSHA1.php +++ b/Tests/Auth/OpenID/HMACSHA1.php @@ -15,10 +15,10 @@ */ require_once('PHPUnit.php'); -require_once('Net/OpenID/HMACSHA1.php'); +require_once('Auth/OpenID/HMACSHA1.php'); -class Tests_Net_OpenID_HMACSHA1_TestCase extends PHPUnit_TestCase { - function Tests_Net_OpenID_HMACSHA1_TestCase( +class Tests_Auth_OpenID_HMACSHA1_TestCase extends PHPUnit_TestCase { + function Tests_Auth_OpenID_HMACSHA1_TestCase( $name, $key, $data, $expected) { @@ -30,12 +30,12 @@ class Tests_Net_OpenID_HMACSHA1_TestCase extends PHPUnit_TestCase { function runTest() { - $actual = Net_OpenID_HMACSHA1($this->key, $this->data); + $actual = Auth_OpenID_HMACSHA1($this->key, $this->data); $this->assertEquals($this->expected, $actual); } } -class Tests_Net_OpenID_HMACSHA1 extends PHPUnit_TestSuite { +class Tests_Auth_OpenID_HMACSHA1 extends PHPUnit_TestSuite { function _strConvert($s) { $repeat_pat = '/^0x([a-f0-9]{2}) repeated (\d+) times$/'; @@ -109,19 +109,19 @@ class Tests_Net_OpenID_HMACSHA1 extends PHPUnit_TestSuite { foreach ($cases as $case) { $clean = array(); $clean["key"] = - Tests_Net_OpenID_HMACSHA1::_strConvert($case["key"]); + Tests_Auth_OpenID_HMACSHA1::_strConvert($case["key"]); if (strlen($clean["key"]) != $case["key_len"]) { trigger_error("Bad key length", E_USER_ERROR); } $clean["data"] = - Tests_Net_OpenID_HMACSHA1::_strConvert($case["data"]); + Tests_Auth_OpenID_HMACSHA1::_strConvert($case["data"]); if (strlen($clean["data"]) != $case["data_len"]) { trigger_error("Bad data length", E_USER_ERROR); } $clean["digest"] = - Tests_Net_OpenID_HMACSHA1::_strConvert($case["digest"]); + Tests_Auth_OpenID_HMACSHA1::_strConvert($case["digest"]); if (strlen($clean["digest"]) != 20) { $l = strlen($clean["digest"]); trigger_error("Bad digest length: $l", E_USER_ERROR); @@ -134,12 +134,12 @@ class Tests_Net_OpenID_HMACSHA1 extends PHPUnit_TestSuite { return $final; } - function Tests_Net_OpenID_HMACSHA1($name) + function Tests_Auth_OpenID_HMACSHA1($name) { $this->setName($name); $cases = $this->_readTestCases(); foreach ($cases as $case) { - $test = new Tests_Net_OpenID_HMACSHA1_TestCase( + $test = new Tests_Auth_OpenID_HMACSHA1_TestCase( $case['test_case'], $case['key'], $case['data'], diff --git a/Tests/Net/OpenID/KVForm.php b/Tests/Auth/OpenID/KVForm.php index eb14849..f103c18 100644 --- a/Tests/Net/OpenID/KVForm.php +++ b/Tests/Auth/OpenID/KVForm.php @@ -14,34 +14,34 @@ */ require_once('PHPUnit.php'); -require_once('Net/OpenID/KVForm.php'); +require_once('Auth/OpenID/KVForm.php'); -$_Tests_Net_OpenID_kverrors = null; +$_Tests_Auth_OpenID_kverrors = null; /** * Keep a list of the logged errors */ -function Tests_Net_OpenID_kvHandleError($errno, $errmsg) +function Tests_Auth_OpenID_kvHandleError($errno, $errmsg) { - global $_Tests_Net_OpenID_kverrors; - $_Tests_Net_OpenID_kverrors[] = $errmsg; + global $_Tests_Auth_OpenID_kverrors; + $_Tests_Auth_OpenID_kverrors[] = $errmsg; } -class Tests_Net_OpenID_KVForm_TestCase extends PHPUnit_TestCase { +class Tests_Auth_OpenID_KVForm_TestCase extends PHPUnit_TestCase { var $errs; function runTest() { // Re-set the number of logged errors - global $_Tests_Net_OpenID_kverrors; - $_Tests_Net_OpenID_kverrors = array(); + global $_Tests_Auth_OpenID_kverrors; + $_Tests_Auth_OpenID_kverrors = array(); - set_error_handler("Tests_Net_OpenID_kvHandleError"); + set_error_handler("Tests_Auth_OpenID_kvHandleError"); $this->_runTest(); // Check to make sure we have the expected number of logged errors - //$this->assertEquals($this->errs, count($_Tests_Net_OpenID_kverrors)); + //$this->assertEquals($this->errs, count($_Tests_Auth_OpenID_kverrors)); restore_error_handler(); } @@ -52,9 +52,9 @@ class Tests_Net_OpenID_KVForm_TestCase extends PHPUnit_TestCase { } } -class Tests_Net_OpenID_KVForm_TestCase_Parse -extends Tests_Net_OpenID_KVForm_TestCase { - function Tests_Net_OpenID_KVForm_TestCase_Parse( +class Tests_Auth_OpenID_KVForm_TestCase_Parse +extends Tests_Auth_OpenID_KVForm_TestCase { + function Tests_Auth_OpenID_KVForm_TestCase_Parse( $arr, $str, $lossy, $errs) { @@ -68,8 +68,8 @@ extends Tests_Net_OpenID_KVForm_TestCase { { // Do one parse, after which arrayToKV and kvToArray should be // inverses. - $parsed1 = Net_OpenID_KVForm::kvToArray($this->str); - $serial1 = Net_OpenID_KVForm::arrayToKV($this->arr); + $parsed1 = Auth_OpenID_KVForm::kvToArray($this->str); + $serial1 = Auth_OpenID_KVForm::arrayToKV($this->arr); if ($this->lossy == "neither" || $this->lossy == "str") { $this->assertEquals($this->arr, $parsed1, "str was lossy"); @@ -79,12 +79,12 @@ extends Tests_Net_OpenID_KVForm_TestCase { $this->assertEquals($this->str, $serial1, "array was lossy"); } - $parsed2 = Net_OpenID_KVForm::kvToArray($serial1); - $serial2 = Net_OpenID_KVForm::arrayToKV($parsed1); + $parsed2 = Auth_OpenID_KVForm::kvToArray($serial1); + $serial2 = Auth_OpenID_KVForm::arrayToKV($parsed1); // Round-trip both - $parsed3 = Net_OpenID_KVForm::kvToArray($serial2); - $serial3 = Net_OpenID_KVForm::arrayToKV($parsed2); + $parsed3 = Auth_OpenID_KVForm::kvToArray($serial2); + $serial3 = Auth_OpenID_KVForm::arrayToKV($parsed2); $this->assertEquals($serial2, $serial3, "serialized forms differ"); @@ -94,9 +94,9 @@ extends Tests_Net_OpenID_KVForm_TestCase { } } -class Tests_Net_OpenID_KVForm_TestCase_Null -extends Tests_Net_OpenID_KVForm_TestCase { - function Tests_Net_OpenID_KVForm_TestCase_Null($arr, $errs) +class Tests_Auth_OpenID_KVForm_TestCase_Null +extends Tests_Auth_OpenID_KVForm_TestCase { + function Tests_Auth_OpenID_KVForm_TestCase_Null($arr, $errs) { $this->arr = $arr; $this->errs = $errs; @@ -104,14 +104,14 @@ extends Tests_Net_OpenID_KVForm_TestCase { function _runTest() { - $serialized = Net_OpenID_KVForm::arrayToKV($this->arr); + $serialized = Auth_OpenID_KVForm::arrayToKV($this->arr); $this->assertTrue($serialized === null, 'serialization unexpectedly succeeded'); } } -class Tests_Net_OpenID_KVForm extends PHPUnit_TestSuite { - function Tests_Net_OpenID_KVForm($name) +class Tests_Auth_OpenID_KVForm extends PHPUnit_TestSuite { + function Tests_Auth_OpenID_KVForm($name) { $this->setName($name); $testdata_list = array( @@ -240,14 +240,14 @@ class Tests_Net_OpenID_KVForm extends PHPUnit_TestSuite { } if (is_null($str)) { - $test = new Tests_Net_OpenID_KVForm_TestCase_Null($arr, $errs); + $test = new Tests_Auth_OpenID_KVForm_TestCase_Null($arr, $errs); } else { if (isset($testdata['lossy'])) { $lossy = $testdata["lossy"]; } else { $lossy = 'neither'; } - $test = new Tests_Net_OpenID_KVForm_TestCase( + $test = new Tests_Auth_OpenID_KVForm_TestCase( $arr, $str, $lossy, $errs); } $test->setName($testdata["name"]); diff --git a/Tests/Net/OpenID/OIDUtil.php b/Tests/Auth/OpenID/OIDUtil.php index af29fe0..f692eb4 100644 --- a/Tests/Net/OpenID/OIDUtil.php +++ b/Tests/Auth/OpenID/OIDUtil.php @@ -14,9 +14,9 @@ */ require_once('PHPUnit.php'); -require_once('Net/OpenID/OIDUtil.php'); +require_once('Auth/OpenID/OIDUtil.php'); -class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase { +class Tests_Auth_OpenID_OIDUtil extends PHPUnit_TestCase { function test_base64() { // This is not good for international use, but PHP doesn't @@ -50,9 +50,9 @@ class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase { ); foreach ($cases as $s) { - $b64 = Net_OpenID_toBase64($s); + $b64 = Auth_OpenID_toBase64($s); checkEncoded($this, $b64, $allowed_d); - $s_prime = Net_OpenID_fromBase64($b64); + $s_prime = Auth_OpenID_fromBase64($b64); $this->assertEquals($s_prime, $s); } @@ -67,9 +67,9 @@ class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase { $s = implode("", array_map('chr', array_map('random_ordinal', range(0, $n)))); - $b64 = Net_OpenID_toBase64($s); + $b64 = Auth_OpenID_toBase64($s); checkEncoded($this, $b64, $allowed_d); - $s_prime = Net_OpenID_fromBase64($b64); + $s_prime = Auth_OpenID_fromBase64($b64); $this->assertEquals($s_prime, $s); } } @@ -77,35 +77,35 @@ class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase { function test_normalizeUrl() { $this->assertEquals("http://foo.com/", - Net_OpenID_normalizeUrl("foo.com")); + Auth_OpenID_normalizeUrl("foo.com")); $this->assertEquals("http://foo.com/", - Net_OpenID_normalizeUrl("http://foo.com")); + Auth_OpenID_normalizeUrl("http://foo.com")); $this->assertEquals("https://foo.com/", - Net_OpenID_normalizeUrl("https://foo.com")); + Auth_OpenID_normalizeUrl("https://foo.com")); $this->assertEquals("http://foo.com/bar", - Net_OpenID_normalizeUrl("foo.com/bar")); + Auth_OpenID_normalizeUrl("foo.com/bar")); $this->assertEquals("http://foo.com/bar", - Net_OpenID_normalizeUrl("http://foo.com/bar")); + Auth_OpenID_normalizeUrl("http://foo.com/bar")); $this->assertEquals("http://foo.com/", - Net_OpenID_normalizeUrl("http://foo.com/")); + Auth_OpenID_normalizeUrl("http://foo.com/")); $this->assertEquals("https://foo.com/", - Net_OpenID_normalizeUrl("https://foo.com/")); + Auth_OpenID_normalizeUrl("https://foo.com/")); $this->assertEquals("https://foo.com/bar" , - Net_OpenID_normalizeUrl("https://foo.com/bar")); + Auth_OpenID_normalizeUrl("https://foo.com/bar")); if (0) { $this->assertEquals("http://foo.com/%E8%8D%89", - Net_OpenID_normalizeUrl("foo.com/\u8349")); + Auth_OpenID_normalizeUrl("foo.com/\u8349")); $this->assertEquals("http://foo.com/%E8%8D%89", - Net_OpenID_normalizeUrl("http://foo.com/\u8349")); + Auth_OpenID_normalizeUrl("http://foo.com/\u8349")); } $non_ascii_domain_cases = array( @@ -140,16 +140,16 @@ class Tests_Net_OpenID_OIDUtil extends PHPUnit_TestCase { for expected, case in non_ascii_domain_cases: try: -actual = Net_OpenID_normalizeUrl(case) +actual = Auth_OpenID_normalizeUrl(case) except UnicodeError: assert should_raise else: assert not should_raise and actual == expected, case */ - $this->assertNull(Net_OpenID_normalizeUrl(null)); - $this->assertNull(Net_OpenID_normalizeUrl('')); - $this->assertNull(Net_OpenID_normalizeUrl('http://')); + $this->assertNull(Auth_OpenID_normalizeUrl(null)); + $this->assertNull(Auth_OpenID_normalizeUrl('')); + $this->assertNull(Auth_OpenID_normalizeUrl('http://')); } function test_appendArgs() @@ -251,7 +251,8 @@ assert not should_raise and actual == expected, case foreach ($cases as $case) { list($desc, $data, $expected) = $case; list($url, $query) = $data; - $this->assertEquals($expected, Net_OpenID_appendArgs($url, $query)); + $this->assertEquals($expected, + Auth_OpenID_appendArgs($url, $query)); } } } diff --git a/Tests/Net/OpenID/Parse.php b/Tests/Auth/OpenID/Parse.php index 52d2180..31cca3b 100644 --- a/Tests/Net/OpenID/Parse.php +++ b/Tests/Auth/OpenID/Parse.php @@ -13,10 +13,10 @@ * @license http://www.gnu.org/copyleft/lesser.html LGPL */ -require_once('Net/OpenID/Consumer/Parse.php'); +require_once('Auth/OpenID/Consumer/Parse.php'); -class Tests_Net_OpenID_Link extends PHPUnit_TestCase { - function Tests_Net_OpenID_Link($case) +class Tests_Auth_OpenID_Link extends PHPUnit_TestCase { + function Tests_Auth_OpenID_Link($case) { list($desc, $markup, $links, $case_text) = $case; $this->desc = $desc; @@ -32,7 +32,7 @@ class Tests_Net_OpenID_Link extends PHPUnit_TestCase { function runTest() { - $parsed = Net_OpenID_parseLinkAttrs($this->markup); + $parsed = Auth_OpenID_parseLinkAttrs($this->markup); $i = 0; foreach ($this->expected_links as $expected) { @@ -91,11 +91,11 @@ class NumTestCases extends PHPUnit_TestCase { } } -class Tests_Net_OpenID_Parse extends PHPUnit_TestSuite { +class Tests_Auth_OpenID_Parse extends PHPUnit_TestSuite { function getName() { - return "Tests_Net_OpenID_Parse"; + return "Tests_Auth_OpenID_Parse"; } function parseLink($line) @@ -154,7 +154,7 @@ class Tests_Net_OpenID_Parse extends PHPUnit_TestSuite { return array($num_tests, $tests); } - function Tests_Net_OpenID_Parse() + function Tests_Auth_OpenID_Parse() { $here = realpath(dirname(__FILE__)); $test_data_file_name = $here . DIRECTORY_SEPARATOR . 'linkparse.txt'; @@ -165,7 +165,7 @@ class Tests_Net_OpenID_Parse extends PHPUnit_TestSuite { $this->addTest(new NumTestCases($test_cases, $num_tests)); foreach ($test_cases as $case) { - $this->addTest(new Tests_Net_OpenID_Link($case)); + $this->addTest(new Tests_Auth_OpenID_Link($case)); } } } diff --git a/Tests/Net/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php index c78e921..f87d9b4 100644 --- a/Tests/Net/OpenID/StoreTest.php +++ b/Tests/Auth/OpenID/StoreTest.php @@ -13,36 +13,36 @@ * @license http://www.gnu.org/copyleft/lesser.html LGPL */ -require_once('Net/OpenID/Association.php'); -require_once('Net/OpenID/CryptUtil.php'); -require_once('Net/OpenID/OIDUtil.php'); +require_once('Auth/OpenID/Association.php'); +require_once('Auth/OpenID/CryptUtil.php'); +require_once('Auth/OpenID/OIDUtil.php'); -class Tests_Net_OpenID_StoreTest extends PHPUnit_TestCase { +class Tests_Auth_OpenID_StoreTest extends PHPUnit_TestCase { function setUp() { - global $_Net_OpenID_letters, $_Net_OpenID_digits, - $_Net_OpenID_punct; + global $_Auth_OpenID_letters, $_Auth_OpenID_digits, + $_Auth_OpenID_punct; - $this->letters = $_Net_OpenID_letters; - $this->digits = $_Net_OpenID_digits; - $this->punct = $_Net_OpenID_punct; + $this->letters = $_Auth_OpenID_letters; + $this->digits = $_Auth_OpenID_digits; + $this->punct = $_Auth_OpenID_punct; $this->allowed_nonce = $this->letters . $this->digits; $this->allowed_handle = $this->letters . $this->digits . $this->punct; } function generateNonce() { - return Net_OpenID_CryptUtil::randomString(8, $this->allowed_nonce); + return Auth_OpenID_CryptUtil::randomString(8, $this->allowed_nonce); } function genAssoc($now, $issued = 0, $lifetime = 600) { - $sec = call_user_func(array('Net_OpenID_CryptUtil', 'randomString'), + $sec = call_user_func(array('Auth_OpenID_CryptUtil', 'randomString'), 20); - $hdl = Net_OpenID_CryptUtil::randomString(128, $this->allowed_handle); - return new Net_OpenID_Association($hdl, $sec, $now + $issued, $lifetime, - 'HMAC-SHA1'); + $hdl = Auth_OpenID_CryptUtil::randomString(128, $this->allowed_handle); + return new Auth_OpenID_Association($hdl, $sec, $now + $issued, + $lifetime, 'HMAC-SHA1'); } function _checkRetrieve(&$store, $url, $handle, $expected, $name=null) @@ -212,21 +212,21 @@ explicitly'); function test_filestore() { - require_once('Net/OpenID/Store/FileStore.php'); + require_once('Auth/OpenID/Store/FileStore.php'); - $temp_dir = Net_OpenID_mkdtemp('/tmp'); + $temp_dir = Auth_OpenID_mkdtemp('/tmp'); if (!$temp_dir) { trigger_error('Could not create temporary directory ' . - 'with Net_OpenID_mkdtemp', E_USER_WARNING); + 'with Auth_OpenID_mkdtemp', E_USER_WARNING); return null; } - $store = new Net_OpenID_FileStore($temp_dir); + $store = new Auth_OpenID_FileStore($temp_dir); $this->_testStore($store); $this->_testNonce($store); $store->destroy(); } } -?>
\ No newline at end of file +?> diff --git a/Tests/Net/OpenID/dhexch b/Tests/Auth/OpenID/dhexch index 7a8be07..7a8be07 100644 --- a/Tests/Net/OpenID/dhexch +++ b/Tests/Auth/OpenID/dhexch diff --git a/Tests/Net/OpenID/dhpriv b/Tests/Auth/OpenID/dhpriv index 0fa5231..0fa5231 100644 --- a/Tests/Net/OpenID/dhpriv +++ b/Tests/Auth/OpenID/dhpriv diff --git a/Tests/Net/OpenID/hmac.txt b/Tests/Auth/OpenID/hmac.txt index 4299a96..4299a96 100644 --- a/Tests/Net/OpenID/hmac.txt +++ b/Tests/Auth/OpenID/hmac.txt diff --git a/Tests/Net/OpenID/linkparse.txt b/Tests/Auth/OpenID/linkparse.txt index 2206395..2206395 100644 --- a/Tests/Net/OpenID/linkparse.txt +++ b/Tests/Auth/OpenID/linkparse.txt diff --git a/Tests/TestDriver.php b/Tests/TestDriver.php index a254541..56ccfc1 100644 --- a/Tests/TestDriver.php +++ b/Tests/TestDriver.php @@ -18,7 +18,7 @@ require_once 'PHPUnit/GUI/HTML.php'; if (defined('E_STRICT')) { // PHP 5 - $_Net_OpenID_allowed_deprecation = + $_Auth_OpenID_allowed_deprecation = array('var', 'is_a()' ); @@ -29,17 +29,17 @@ if (defined('E_STRICT')) { // Augment this // regular expression if the bug exists in another version. if (preg_match('/^5\.1\.1$/', phpversion()) && $errno == 2) { - $allowed_files = array(array('/Net/OpenID/CryptUtil.php', + $allowed_files = array(array('/Auth/OpenID/CryptUtil.php', 'dl'), - array('/Net/OpenID/OIDUtil.php', + array('/Auth/OpenID/OIDUtil.php', 'parse_url'), - array('/Net/OpenID/Store/FileStore.php', + array('/Auth/OpenID/Store/FileStore.php', 'mkdir'), - array('/Net/OpenID/Store/FileStore.php', + array('/Auth/OpenID/Store/FileStore.php', 'stat'), - array('/Net/OpenID/Store/FileStore.php', + array('/Auth/OpenID/Store/FileStore.php', 'fopen'), - array('/Net/OpenID/Store/FileStore.php', + array('/Auth/OpenID/Store/FileStore.php', 'unlink')); foreach ($allowed_files as $entry) { @@ -53,17 +53,17 @@ if (defined('E_STRICT')) { } } - global $_Net_OpenID_allowed_deprecation; + global $_Auth_OpenID_allowed_deprecation; switch ($errno) { case E_STRICT: // XXX: limit this to files we know about - foreach ($_Net_OpenID_allowed_deprecation as $depr) { + foreach ($_Auth_OpenID_allowed_deprecation as $depr) { if (strpos($errstr, "$depr: Deprecated.") !== false) { return; } } - $pat = '/^Non-static method Net_OpenID_[A-Za-z0-9_]+' . + $pat = '/^Non-static method Auth_OpenID_[A-Za-z0-9_]+' . '::[A-Za-z0-9_]+\(\) (cannot|should not) be ' . 'called statically$/'; if (preg_match($pat, $errstr)) { @@ -127,7 +127,7 @@ function global_require_once($name) } } -$_test_dir = 'Tests/Net/OpenID/'; +$_test_dir = 'Tests/Auth/OpenID/'; $_test_names = array( 'KVForm', 'CryptUtil', |