diff options
Diffstat (limited to 'Tests/Auth/OpenID')
-rw-r--r-- | Tests/Auth/OpenID/BigMath.php | 2 | ||||
-rw-r--r-- | Tests/Auth/OpenID/Consumer.php | 26 | ||||
-rw-r--r-- | Tests/Auth/OpenID/DiffieHellman.php | 2 | ||||
-rw-r--r-- | Tests/Auth/OpenID/Discover_OpenID.php | 6 | ||||
-rw-r--r-- | Tests/Auth/OpenID/MemStore.php | 2 | ||||
-rw-r--r-- | Tests/Auth/OpenID/Message.php | 2 | ||||
-rw-r--r-- | Tests/Auth/OpenID/RPVerify.php | 15 | ||||
-rw-r--r-- | Tests/Auth/OpenID/SReg.php | 4 | ||||
-rw-r--r-- | Tests/Auth/OpenID/Server.php | 12 | ||||
-rw-r--r-- | Tests/Auth/OpenID/StoreTest.php | 21 | ||||
-rw-r--r-- | Tests/Auth/OpenID/VerifyDisco.php | 2 |
11 files changed, 42 insertions, 52 deletions
diff --git a/Tests/Auth/OpenID/BigMath.php b/Tests/Auth/OpenID/BigMath.php index fb258d9..acab4d9 100644 --- a/Tests/Auth/OpenID/BigMath.php +++ b/Tests/Auth/OpenID/BigMath.php @@ -159,7 +159,7 @@ class Tests_Auth_OpenID_BigMath extends PHPUnit_Framework_TestSuite { function _addB64Tests() { - $lib =& Auth_OpenID_getMathLib(); + $lib = Auth_OpenID_getMathLib(); $count = defined('Tests_Auth_OpenID_thorough') ? -1 : 2; $data = $this->_parseBase64Data(); foreach ($data as $b64 => $num_s) { diff --git a/Tests/Auth/OpenID/Consumer.php b/Tests/Auth/OpenID/Consumer.php index 73f2a21..761f9f2 100644 --- a/Tests/Auth/OpenID/Consumer.php +++ b/Tests/Auth/OpenID/Consumer.php @@ -1693,12 +1693,12 @@ class Tests_Auth_OpenID_AuthRequestHTMLMarkup extends PHPUnit_Framework_TestCase { $html = $this->request->htmlMarkup('http://realm.com/', 'http://realm.com/return_to'); - $this->assertTrue(substr($html,"<html>") !== false); - $this->assertTrue(substr($html,"</html>") !== false); - $this->assertTrue(substr($html,"<body onload") !== false); - $this->assertTrue(substr($html,"</body>") !== false); - $this->assertTrue(substr($html,"<form") !== false); - $this->assertTrue(substr($html,"</form>") !== false); + $this->assertTrue(strpos($html,"<html>") !== false); + $this->assertTrue(strpos($html,"</html>") !== false); + $this->assertTrue(strpos($html,"<body onload") !== false); + $this->assertTrue(strpos($html,"</body>") !== false); + $this->assertTrue(strpos($html,"<form") !== false); + $this->assertTrue(strpos($html,"</form>") !== false); } } @@ -1817,9 +1817,9 @@ class Tests_Auth_OpenID_DiscoFailure extends PHPUnit_Framework_TestCase { $this->store = null; $this->session = new Auth_Yadis_PHPSession(); $cls = $this->consumerClass; - $this->consumer =& new $cls($this->store, $this->session); - $this->consumer->consumer =& new _StubConsumer(); - $this->discovery =& new Auth_Yadis_Discovery($this->session, + $this->consumer = new $cls($this->store, $this->session); + $this->consumer->consumer = new _StubConsumer(); + $this->discovery = new Auth_Yadis_Discovery($this->session, $this->claimed_id, $this->consumer->session_key_prefix); } @@ -1848,9 +1848,9 @@ class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_Framework_TestCase { $this->endpoint->claimed_id = $this->claimed_id; $this->store = null; $this->session = new Auth_Yadis_PHPSession(); - $this->consumer =& new Auth_OpenID_Consumer($this->store, $this->session); - $this->consumer->consumer =& new _StubConsumer(); - $this->discovery =& new Auth_Yadis_Discovery($this->session, + $this->consumer = new Auth_OpenID_Consumer($this->store, $this->session); + $this->consumer->consumer = new _StubConsumer(); + $this->discovery = new Auth_Yadis_Discovery($this->session, $this->claimed_id, $this->consumer->session_key_prefix); } @@ -2385,7 +2385,7 @@ class TestDiffieHellmanResponseParameters extends PHPUnit_Framework_TestCase { $this->server_dh = new Auth_OpenID_DiffieHellman(100389557, 2); $this->consumer_dh = new Auth_OpenID_DiffieHellman(100389557, 2); - $lib =& Auth_OpenID_getMathLib(); + $lib = Auth_OpenID_getMathLib(); $cls = $this->session_cls; $this->consumer_session = new $cls($this->consumer_dh); diff --git a/Tests/Auth/OpenID/DiffieHellman.php b/Tests/Auth/OpenID/DiffieHellman.php index 3336061..524c011 100644 --- a/Tests/Auth/OpenID/DiffieHellman.php +++ b/Tests/Auth/OpenID/DiffieHellman.php @@ -57,7 +57,7 @@ class Tests_Auth_OpenID_DiffieHellman_Exch extends PHPUnit_Framework_TestCase { function runTest() { - $lib =& Auth_OpenID_getMathLib(); + $lib = Auth_OpenID_getMathLib(); $shared = $lib->init($this->shared); $dh1 = new Auth_OpenID_DiffieHellman(null, null, $this->p1); $dh2 = new Auth_OpenID_DiffieHellman(null, null, $this->p2); diff --git a/Tests/Auth/OpenID/Discover_OpenID.php b/Tests/Auth/OpenID/Discover_OpenID.php index 03d25dc..740548d 100644 --- a/Tests/Auth/OpenID/Discover_OpenID.php +++ b/Tests/Auth/OpenID/Discover_OpenID.php @@ -715,7 +715,7 @@ class Tests_Auth_OpenID_SSLSupport extends PHPUnit_Framework_TestCase { Tests_Auth_OpenID_readdata('test_discover_openid_ssl.xml')) ); - $f =& new _FetcherWithoutSSL($d); + $f = new _FetcherWithoutSSL($d); $result = Auth_OpenID_discover($id_url, $f); @@ -742,7 +742,7 @@ class Tests_Auth_OpenID_SSLSupport extends PHPUnit_Framework_TestCase { Tests_Auth_OpenID_readdata('test_discover_openid_ssl.xml')) ); - $f =& new _FetcherWithSSL($d); + $f = new _FetcherWithSSL($d); $result = Auth_OpenID_discover($id_url, $f); @@ -765,7 +765,7 @@ class Tests_Auth_OpenID_SSLSupport extends PHPUnit_Framework_TestCase { $id_url = 'https://unsupported/'; - $f =& new _NonFetcher(); + $f = new _NonFetcher(); $result = Auth_OpenID_discover($id_url, $f); diff --git a/Tests/Auth/OpenID/MemStore.php b/Tests/Auth/OpenID/MemStore.php index 68a085f..7724719 100644 --- a/Tests/Auth/OpenID/MemStore.php +++ b/Tests/Auth/OpenID/MemStore.php @@ -85,7 +85,7 @@ class Tests_Auth_OpenID_MemStore extends Auth_OpenID_OpenIDStore { function &_getServerAssocs($server_url) { if (!array_key_exists($server_url, $this->server_assocs)) { - $this->server_assocs[$server_url] =& new ServerAssocs(); + $this->server_assocs[$server_url] = new ServerAssocs(); } return $this->server_assocs[$server_url]; diff --git a/Tests/Auth/OpenID/Message.php b/Tests/Auth/OpenID/Message.php index 88706e5..0205fc4 100644 --- a/Tests/Auth/OpenID/Message.php +++ b/Tests/Auth/OpenID/Message.php @@ -980,7 +980,7 @@ class Tests_Auth_OpenID_GeneralMessageTest extends PHPUnit_Framework_TestCase { function _checkForm($html, $message_, $action_url, $form_tag_attrs, $submit_text) { - $parser =& Auth_Yadis_getXMLParser(); + $parser = Auth_Yadis_getXMLParser(); // Parse HTML source $this->assertTrue($parser->init($html, array())); diff --git a/Tests/Auth/OpenID/RPVerify.php b/Tests/Auth/OpenID/RPVerify.php index e09138a..1482af4 100644 --- a/Tests/Auth/OpenID/RPVerify.php +++ b/Tests/Auth/OpenID/RPVerify.php @@ -9,9 +9,6 @@ require_once 'Auth/OpenID/TrustRoot.php'; require_once 'Auth/Yadis/Yadis.php'; -// Because "null" cannot be passed by reference. -$NULL_FETCHER = null; - /* * Tests for building the discovery URL from a realm and a return_to * URL @@ -67,7 +64,7 @@ class Tests_Auth_OpenID_ExtractReturnToURLs extends PHPUnit_Framework_TestCase { function failUnlessXRDSHasReturnURLs($data, $expected_return_urls) { $discover_object = new _MockDiscover($data); - $actual_return_urls = Auth_OpenID_getAllowedReturnURLs($this->disco_url, $NULL_FETCHER, array($discover_object, 'mockDiscover')); + $actual_return_urls = Auth_OpenID_getAllowedReturnURLs($this->disco_url, null, array($discover_object, 'mockDiscover')); $this->assertEquals($expected_return_urls, $actual_return_urls); } @@ -75,7 +72,7 @@ class Tests_Auth_OpenID_ExtractReturnToURLs extends PHPUnit_Framework_TestCase { function failUnlessDiscoveryFailure($text) { $discover_object = new _MockDiscover($text); - $this->assertFalse(Auth_OpenID_getAllowedReturnURLs($this->disco_url, $NULL_FETCHER, array($discover_object, 'mockDiscover'))); + $this->assertFalse(Auth_OpenID_getAllowedReturnURLs($this->disco_url, null, array($discover_object, 'mockDiscover'))); } function test_empty() @@ -244,7 +241,7 @@ class Tests_Auth_OpenID_VerifyReturnTo extends PHPUnit_Framework_TestCase { function test_bogusRealm() { - $this->assertFalse(Auth_OpenID_verifyReturnTo('', 'http://example.com/', $NULL_FETCHER)); + $this->assertFalse(Auth_OpenID_verifyReturnTo('', 'http://example.com/', null)); } function test_verifyWithDiscoveryCalled() @@ -254,7 +251,7 @@ class Tests_Auth_OpenID_VerifyReturnTo extends PHPUnit_Framework_TestCase { $v = new Verifier($this, $return_to); - $this->assertTrue(Auth_OpenID_verifyReturnTo($realm, $return_to, $NULL_FETCHER, array($v, 'verify'))); + $this->assertTrue(Auth_OpenID_verifyReturnTo($realm, $return_to, null, array($v, 'verify'))); } function test_verifyFailWithDiscoveryCalled() @@ -264,7 +261,7 @@ class Tests_Auth_OpenID_VerifyReturnTo extends PHPUnit_Framework_TestCase { $v = new Verifier($this, 'http://something-else.invalid/'); - $this->assertFalse(Auth_OpenID_verifyReturnTo($realm, $return_to, $NULL_FETCHER, array($v, 'verify'))); + $this->assertFalse(Auth_OpenID_verifyReturnTo($realm, $return_to, null, array($v, 'verify'))); } function test_verifyFailIfDiscoveryRedirects() @@ -274,7 +271,7 @@ class Tests_Auth_OpenID_VerifyReturnTo extends PHPUnit_Framework_TestCase { $v = new Verifier($this, false); - $this->assertFalse(Auth_OpenID_verifyReturnTo($realm, $return_to, $NULL_FETCHER, array($v, 'verify'))); + $this->assertFalse(Auth_OpenID_verifyReturnTo($realm, $return_to, null, array($v, 'verify'))); } } diff --git a/Tests/Auth/OpenID/SReg.php b/Tests/Auth/OpenID/SReg.php index 5546600..db5cd51 100644 --- a/Tests/Auth/OpenID/SReg.php +++ b/Tests/Auth/OpenID/SReg.php @@ -209,14 +209,14 @@ function &__getTestCase() { } class TestingReq extends Auth_OpenID_SRegRequest { - function fromOpenIDRequest($thing, $test_case) + static function fromOpenIDRequest($thing, $test_case) { __setTestCase($test_case); $obj = parent::fromOpenIDRequest($thing, 'TestingReq'); return $obj; } - function _getSRegNS($unused) + static function _getSRegNS($unused) { global $__ns_sentinel; return $__ns_sentinel; diff --git a/Tests/Auth/OpenID/Server.php b/Tests/Auth/OpenID/Server.php index bcb4f2a..d5dea91 100644 --- a/Tests/Auth/OpenID/Server.php +++ b/Tests/Auth/OpenID/Server.php @@ -12,7 +12,7 @@ require_once "Auth/OpenID/Consumer.php"; function altModulus() { - $lib =& Auth_OpenID_getMathLib(); + $lib = Auth_OpenID_getMathLib(); static $num = null; if (!$num) { @@ -520,7 +520,7 @@ class Tests_Auth_OpenID_Test_Decode extends PHPUnit_Framework_TestCase { // test dh with non-default but valid values for dh_modulus // and dh_gen - $lib =& Auth_OpenID_getMathLib(); + $lib = Auth_OpenID_getMathLib(); $args = array( 'openid.mode' => 'associate', @@ -1661,7 +1661,7 @@ class Tests_Auth_OpenID_Associate extends PHPUnit_Framework_TestCase { 'HMAC-SHA1'); $dh = new Auth_OpenID_DiffieHellman(); - $ml =& Auth_OpenID_getMathLib(); + $ml = Auth_OpenID_getMathLib(); $cpub = $dh->public; $session = new Auth_OpenID_DiffieHellmanSHA1ServerSession( @@ -1743,7 +1743,7 @@ class Tests_Auth_OpenID_Associate extends PHPUnit_Framework_TestCase { $enc_key = base64_decode( $response->fields->getArg(Auth_OpenID_OPENID_NS, "enc_mac_key")); - $lib =& Auth_OpenID_getMathLib(); + $lib = Auth_OpenID_getMathLib(); $spub = $lib->base64ToLong($response->fields->getArg(Auth_OpenID_OPENID_NS, "dh_server_public")); $secret = $consumer_dh->xorSecret($spub, $enc_key, 'Auth_OpenID_SHA256'); @@ -2148,8 +2148,8 @@ class Tests_Auth_OpenID_ServerTest extends PHPUnit_Framework_TestCase { class Tests_Auth_OpenID_Signatory extends PHPUnit_Framework_TestCase { function setUp() { - $this->store =& new Tests_Auth_OpenID_MemStore(); - $this->signatory =& new Auth_OpenID_Signatory($this->store); + $this->store = new Tests_Auth_OpenID_MemStore(); + $this->signatory = new Auth_OpenID_Signatory($this->store); $this->dumb_key = $this->signatory->dumb_key; $this->normal_key = $this->signatory->normal_key; } diff --git a/Tests/Auth/OpenID/StoreTest.php b/Tests/Auth/OpenID/StoreTest.php index 5e8c8d4..7c50e2f 100644 --- a/Tests/Auth/OpenID/StoreTest.php +++ b/Tests/Auth/OpenID/StoreTest.php @@ -438,9 +438,7 @@ class Tests_Auth_OpenID_Included_StoreTest extends Tests_Auth_OpenID_Store { { // If the postgres extension isn't loaded or loadable, succeed // because we can't run the test. - if (!(extension_loaded('pgsql') || - @dl('pgsql.so') || - @dl('php_pgsql.dll')) || + if (!(extension_loaded('pgsql')) || !(@include_once 'DB.php')) { print "(not testing PostGreSQL store)"; $this->pass(); @@ -512,7 +510,7 @@ class Tests_Auth_OpenID_Included_StoreTest extends Tests_Auth_OpenID_Store { return; } - $store =& new Auth_OpenID_PostgreSQLStore($db); + $store = new Auth_OpenID_PostgreSQLStore($db); $this->assertFalse($store->tableExists($store->nonces_table_name)); $this->assertFalse($store->tableExists($store->associations_table_name)); @@ -558,9 +556,7 @@ class Tests_Auth_OpenID_Included_StoreTest extends Tests_Auth_OpenID_Store { { // If the sqlite extension isn't loaded or loadable, succeed // because we can't run the test. - if (!(extension_loaded('sqlite') || - @dl('sqlite.so') || - @dl('php_sqlite.dll')) || + if (!(extension_loaded('sqlite')) || !(@include_once 'DB.php')) { print "(not testing SQLite store)"; $this->pass(); @@ -585,7 +581,7 @@ class Tests_Auth_OpenID_Included_StoreTest extends Tests_Auth_OpenID_Store { $this->pass("SQLite database connection failed: " . $db->getMessage()); } else { - $store =& new Auth_OpenID_SQLiteStore($db); + $store = new Auth_OpenID_SQLiteStore($db); $this->assertTrue($store->createTables(), "Table creation failed"); $this->_testStore($store); $this->_testNonce($store); @@ -603,8 +599,7 @@ class Tests_Auth_OpenID_Included_StoreTest extends Tests_Auth_OpenID_Store { { // If the mysql extension isn't loaded or loadable, succeed // because we can't run the test. - if (!(extension_loaded('mysql') || - @dl('mysql.' . PHP_SHLIB_SUFFIX)) || + if (!(extension_loaded('mysql')) || !(@include_once 'DB.php')) { print "(not testing MySQL store)"; $this->pass(); @@ -643,7 +638,7 @@ class Tests_Auth_OpenID_Included_StoreTest extends Tests_Auth_OpenID_Store { $db->query("USE $temp_db_name"); - $store =& new Auth_OpenID_MySQLStore($db); + $store = new Auth_OpenID_MySQLStore($db); $store->createTables(); $this->_testStore($store); $this->_testNonce($store); @@ -720,9 +715,7 @@ class Tests_Auth_OpenID_MemcachedStore_Test extends Tests_Auth_OpenID_Store { { // If the memcache extension isn't loaded or loadable, succeed // because we can't run the test. - if (!(extension_loaded('memcache') || - @dl('memcache.so') || - @dl('php_memcache.dll'))) { + if (!extension_loaded('memcache')) { print "(skipping memcache store tests)"; $this->pass(); return; diff --git a/Tests/Auth/OpenID/VerifyDisco.php b/Tests/Auth/OpenID/VerifyDisco.php index f18d3aa..ea2566d 100644 --- a/Tests/Auth/OpenID/VerifyDisco.php +++ b/Tests/Auth/OpenID/VerifyDisco.php @@ -171,7 +171,7 @@ class Tests_Auth_OpenID_VerifyDisco extends _DiscoverAndVerify { function test_openid2UsePreDiscoveredWrongType() { - $this->consumer =& new Tests_Auth_OpenID_VerifyDisco_1($this->store); + $this->consumer = new Tests_Auth_OpenID_VerifyDisco_1($this->store); $this->consumer->test_case =& $this; $this->consumer->text = "verify failed"; |