summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authortailor <cygnus@janrain.com>2007-02-13 19:34:19 +0000
committertailor <cygnus@janrain.com>2007-02-13 19:34:19 +0000
commit789e9db7ff45a1942ddcef9931f0b3961f3d3a7d (patch)
tree915ccdbe4efdfd1f8527be4d0a215581a9181d89
parent7eee528d291f8daaba3ec57b843de85027918209 (diff)
downloadphp-openid-789e9db7ff45a1942ddcef9931f0b3961f3d3a7d.zip
php-openid-789e9db7ff45a1942ddcef9931f0b3961f3d3a7d.tar.gz
php-openid-789e9db7ff45a1942ddcef9931f0b3961f3d3a7d.tar.bz2
[project @ Fix tests (include HMACSHA1/256 and fix reference usage)]
-rw-r--r--Auth/OpenID/Consumer.php6
-rw-r--r--Tests/Auth/OpenID/Consumer.php14
-rw-r--r--Tests/Auth/OpenID/Server.php12
-rw-r--r--admin/texttest.php3
4 files changed, 23 insertions, 12 deletions
diff --git a/Auth/OpenID/Consumer.php b/Auth/OpenID/Consumer.php
index dd1eb47..e23fcbe 100644
--- a/Auth/OpenID/Consumer.php
+++ b/Auth/OpenID/Consumer.php
@@ -296,9 +296,9 @@ class Auth_OpenID_Consumer {
{
$openid_url = $user_url;
- $disco =& $this->getDiscoveryObject($this->session,
- $openid_url,
- $this->session_key_prefix);
+ $disco = $this->getDiscoveryObject($this->session,
+ $openid_url,
+ $this->session_key_prefix);
// Set the 'stale' attribute of the manager. If discovery
// fails in a fatal way, the stale flag will cause the manager
diff --git a/Tests/Auth/OpenID/Consumer.php b/Tests/Auth/OpenID/Consumer.php
index c654d73..b468dd6 100644
--- a/Tests/Auth/OpenID/Consumer.php
+++ b/Tests/Auth/OpenID/Consumer.php
@@ -23,6 +23,7 @@ require_once 'Auth/OpenID/KVForm.php';
require_once 'Auth/OpenID/Consumer.php';
require_once 'Auth/OpenID/Server.php';
require_once 'Auth/OpenID/Nonce.php';
+require_once 'Auth/OpenID/HMACSHA1.php';
require_once 'Tests/Auth/OpenID/MemStore.php';
require_once 'PHPUnit.php';
@@ -1583,7 +1584,7 @@ class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_TestCase {
$this->endpoint->claimed_id = $this->claimed_id;
$this->store = null;
$this->session = new Services_Yadis_PHPSession();
- $this->consumer =& new Auth_OpenID_Consumer($this->store, &$this->session);
+ $this->consumer =& new Auth_OpenID_Consumer($this->store, $this->session);
$this->consumer->consumer =& new _StubConsumer();
$this->discovery =& new Services_Yadis_Discovery(&$this->session,
$this->claimed_id,
@@ -2113,9 +2114,12 @@ class TestOpenID2SHA1 extends TestDiffieHellmanResponseParameters {
var $message_namespace = Auth_OpenID_OPENID2_NS;
}
-class TestOpenID2SHA256 extends TestDiffieHellmanResponseParameters {
- var $session_cls = 'Auth_OpenID_DiffieHellmanSHA256ConsumerSession';
- var $message_namespace = Auth_OpenID_OPENID2_NS;
+if (!defined('Auth_OpenID_NO_MATH_SUPPORT') &&
+ Auth_OpenID_SHA256_SUPPORTED) {
+ class TestOpenID2SHA256 extends TestDiffieHellmanResponseParameters {
+ var $session_cls = 'Auth_OpenID_DiffieHellmanSHA256ConsumerSession';
+ var $message_namespace = Auth_OpenID_OPENID2_NS;
+ }
}
// Add other test cases to be run.
@@ -2146,7 +2150,7 @@ if (!defined('Auth_OpenID_NO_MATH_SUPPORT')) {
}
if (!defined('Auth_OpenID_NO_MATH_SUPPORT') &&
- Auth_OpenID_SHA256_AVAILABLE) {
+ Auth_OpenID_SHA256_SUPPORTED) {
$Tests_Auth_OpenID_Consumer_other[] = new TestOpenID2SHA256();
}
diff --git a/Tests/Auth/OpenID/Server.php b/Tests/Auth/OpenID/Server.php
index a0e186c..962371b 100644
--- a/Tests/Auth/OpenID/Server.php
+++ b/Tests/Auth/OpenID/Server.php
@@ -1351,7 +1351,8 @@ class Tests_Auth_OpenID_Associate extends PHPUnit_TestCase {
function test_dhSHA256()
{
- if (!Auth_OpenID_SHA256_SUPPORTED) {
+ if (defined('Auth_OpenID_NO_MATH_SUPPORT') ||
+ !Auth_OpenID_SHA256_SUPPORTED) {
print "(Skipping test_dhSHA256)";
return;
}
@@ -1397,7 +1398,8 @@ class Tests_Auth_OpenID_Associate extends PHPUnit_TestCase {
function test_protoError256()
{
- if (!Auth_OpenID_HMACSHA256_SUPPORTED) {
+ if (defined('Auth_OpenID_NO_MATH_SUPPORT') ||
+ !Auth_OpenID_HMACSHA256_SUPPORTED) {
print "(Skipping test_protoError256)";
return;
}
@@ -1541,7 +1543,8 @@ class Tests_Auth_OpenID_Associate extends PHPUnit_TestCase {
function test_plaintext256()
{
- if (!Auth_OpenID_SHA256_SUPPORTED) {
+ if (defined('Auth_OpenID_NO_MATH_SUPPORT') ||
+ !Auth_OpenID_SHA256_SUPPORTED) {
print "(Skipping test_plaintext256)";
return;
}
@@ -1668,7 +1671,8 @@ class Tests_Auth_OpenID_ServerTest extends PHPUnit_TestCase {
function test_associate3()
{
- if (!Auth_OpenID_HMACSHA256_SUPPORTED) {
+ if (defined('Auth_OpenID_NO_MATH_SUPPORT') ||
+ !Auth_OpenID_HMACSHA256_SUPPORTED) {
print "(Skipping test_associate3)";
return;
}
diff --git a/admin/texttest.php b/admin/texttest.php
index cbfe0af..5564aae 100644
--- a/admin/texttest.php
+++ b/admin/texttest.php
@@ -1,5 +1,8 @@
<?php
+define('Auth_OpenID_SHA256_SUPPORTED', false);
+define('Auth_OpenID_HMACSHA256_SUPPORTED', false);
+
require_once 'Tests/TestDriver.php';
require_once 'PHPUnit/TestResult.php';
require_once 'Console/Getopt.php';