diff options
author | Luke Shepard <lshepard@devrs006.snc1.facebook.com> | 2009-05-27 10:54:14 -0700 |
---|---|---|
committer | Luke Shepard <lshepard@devrs006.snc1.facebook.com> | 2009-05-27 10:54:14 -0700 |
commit | ae52c6b3a3b9741c0ef60b6c91ba27af1d85eab7 (patch) | |
tree | 450c172565fffe576264e64ea83a9c4978709da9 /Tests/Auth/OpenID/Consumer.php | |
parent | 5a96dc7b3fbd600f5acbbf08cf8d2d131aa7f2d3 (diff) | |
download | php-openid-ae52c6b3a3b9741c0ef60b6c91ba27af1d85eab7.zip php-openid-ae52c6b3a3b9741c0ef60b6c91ba27af1d85eab7.tar.gz php-openid-ae52c6b3a3b9741c0ef60b6c91ba27af1d85eab7.tar.bz2 |
[ Upgrading php-openid test framework to use PHPUnit 3.3 ]
Reviewed By: Will Norris
The set of tests assumes PHPUnit 2.3, which conflicts with my environment setup.
I think PHPUnit 3.3 is pretty widespread now, and under active maintenance
(latest rev 4/10/2009).
There's a few changes included here. I did a few mostly automated code
transformations:
replace "PHPUnit_TestCase" "PHPUnit_Framework_TestCase"
replace "PHPUnit_TestSuite" "PHPUnit_Framework_TestSuite"
removed all require_once "PHPUnit.php" - they are unnecessary.
"call by reference" is now deprecated, so changed "&$" to "$"
I also made a few changes to admin/testtext.php and Tests/TestDriver.php to
accomodate the new syntax.
Note that this just upgrades the framework; it does not guarantee that all tests
pass. I'll submit future diffs to fix or disable failing unit tests. I wasn't
able to get the tests running with the previous version, so I don't know if
these have always been failing.
I doubt that the github has automatically running unit tests, but if so then
we'll have to make sure that the central repo is running the same version of
PHPUnit.
Diffstat (limited to 'Tests/Auth/OpenID/Consumer.php')
-rw-r--r-- | Tests/Auth/OpenID/Consumer.php | 45 |
1 files changed, 21 insertions, 24 deletions
diff --git a/Tests/Auth/OpenID/Consumer.php b/Tests/Auth/OpenID/Consumer.php index a762a9d..aa12671 100644 --- a/Tests/Auth/OpenID/Consumer.php +++ b/Tests/Auth/OpenID/Consumer.php @@ -13,8 +13,6 @@ * @license http://www.apache.org/licenses/LICENSE-2.0 Apache */ -@session_start(); - require_once 'Auth/OpenID/CryptUtil.php'; require_once 'Auth/Yadis/HTTPFetcher.php'; require_once 'Auth/OpenID/DiffieHellman.php'; @@ -26,7 +24,6 @@ require_once 'Auth/OpenID/Nonce.php'; require_once 'Auth/OpenID/SReg.php'; require_once 'Auth/OpenID/Message.php'; require_once 'Tests/Auth/OpenID/MemStore.php'; -require_once 'PHPUnit.php'; /* * Convenience function to create a SuccessResponse with the given @@ -54,7 +51,7 @@ class FastConsumerSession extends Auth_OpenID_DiffieHellmanSHA1ConsumerSession { } } -function setConsumerSession(&$con) +function setConsumerSession($con) { $con->session_types = array('DH-SHA1' => 'FastConsumerSession'); } @@ -192,10 +189,10 @@ $_Auth_OpenID_server_url = "http://server.example.com/"; global $_Auth_OpenID_consumer_url; $_Auth_OpenID_consumer_url = "http://consumer.example.com/"; -class Tests_Auth_OpenID_Consumer extends PHPUnit_TestCase { +class Tests_Auth_OpenID_Consumer extends PHPUnit_Framework_TestCase { - function _run(&$consumer, $user_url, $mode, $delegate_url, - &$fetcher, &$store, $immediate) + function _run($consumer, $user_url, $mode, $delegate_url, + $fetcher, $store, $immediate) { global $_Auth_OpenID_consumer_url, $_Auth_OpenID_server_url; @@ -372,7 +369,7 @@ class ConfigurableConsumer extends Auth_OpenID_GenericConsumer { } } -class _TestIdRes extends PHPUnit_TestCase { +class _TestIdRes extends PHPUnit_Framework_TestCase { var $consumer_class = 'ConfigurableConsumer'; function setUp() @@ -1133,7 +1130,7 @@ class TempConsumer extends ConfigurableConsumer { } } -class TestCompleteMissingSig extends PHPUnit_TestCase { +class TestCompleteMissingSig extends PHPUnit_Framework_TestCase { function setUp() { @@ -1224,7 +1221,7 @@ class TestCompleteMissingSig extends PHPUnit_TestCase { } } -class TestReturnToArgs extends PHPUnit_TestCase { +class TestReturnToArgs extends PHPUnit_Framework_TestCase { function setUp() { $store = null; @@ -1586,7 +1583,7 @@ class Tests_Auth_OpenID_Consumer_TestCheckAuth extends _TestIdRes { } } -class Tests_Auth_OpenID_Consumer_TestFetchAssoc extends PHPUnit_TestCase { +class Tests_Auth_OpenID_Consumer_TestFetchAssoc extends PHPUnit_Framework_TestCase { function setUp() { $this->store = new Tests_Auth_OpenID_MemStore(); @@ -1659,7 +1656,7 @@ class Tests_Auth_OpenID_Consumer_TestFetchAssoc extends PHPUnit_TestCase { } } -class Tests_Auth_OpenID_AuthRequestHTMLMarkup extends PHPUnit_TestCase { +class Tests_Auth_OpenID_AuthRequestHTMLMarkup extends PHPUnit_Framework_TestCase { function setUp() { $this->endpoint = new Auth_OpenID_ServiceEndpoint(); @@ -1681,7 +1678,7 @@ class Tests_Auth_OpenID_AuthRequestHTMLMarkup extends PHPUnit_TestCase { } } -class Tests_Auth_OpenID_SuccessResponse extends PHPUnit_TestCase { +class Tests_Auth_OpenID_SuccessResponse extends PHPUnit_Framework_TestCase { function setUp() { $this->endpoint = new Auth_OpenID_ServiceEndpoint(); @@ -1781,7 +1778,7 @@ class _StubConsumer { } } -class Tests_Auth_OpenID_DiscoFailure extends PHPUnit_TestCase { +class Tests_Auth_OpenID_DiscoFailure extends PHPUnit_Framework_TestCase { var $consumerClass = null; function setUp() @@ -1796,9 +1793,9 @@ class Tests_Auth_OpenID_DiscoFailure extends PHPUnit_TestCase { $this->store = null; $this->session = new Auth_Yadis_PHPSession(); $cls = $this->consumerClass; - $this->consumer =& new $cls($this->store, &$this->session); + $this->consumer =& new $cls($this->store, $this->session); $this->consumer->consumer =& new _StubConsumer(); - $this->discovery =& new Auth_Yadis_Discovery(&$this->session, + $this->discovery =& new Auth_Yadis_Discovery($this->session, $this->claimed_id, $this->consumer->session_key_prefix); } @@ -1815,7 +1812,7 @@ class Consumer_completeEmptySession extends Auth_OpenID_GenericConsumer { } } -class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_TestCase { +class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_Framework_TestCase { function setUp() { foreach ($_SESSION as $k => $v) { @@ -1829,7 +1826,7 @@ class Tests_Auth_OpenID_ConsumerTest2 extends PHPUnit_TestCase { $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->discovery =& new Auth_Yadis_Discovery($this->session, $this->claimed_id, $this->consumer->session_key_prefix); } @@ -2047,7 +2044,7 @@ class IDPDrivenTest_Consumer2 extends ConfigurableConsumer { } } -class IDPDrivenTest extends PHPUnit_TestCase { +class IDPDrivenTest extends PHPUnit_Framework_TestCase { function setUp() { $this->store = new GoodAssocStore(); @@ -2067,7 +2064,7 @@ class IDPDrivenTest extends PHPUnit_TestCase { global $GOODSIG; $this->consumer = new IDPDrivenTest_Consumer1($this->store); - $this->consumer->failure_cb = array(&$this, "assertTrue"); + $this->consumer->failure_cb = array($this, "assertTrue"); $this->consumer->check_endpoint =& $this->endpoint; $identifier = '=directed_identifier'; @@ -2134,7 +2131,7 @@ class TestDiscoveryVerification_test_otherServer extends Auth_OpenID_GenericCons } } -class TestDiscoveryVerification extends PHPUnit_TestCase { +class TestDiscoveryVerification extends PHPUnit_Framework_TestCase { var $services = array(); function discoveryFunc($identifier) @@ -2240,7 +2237,7 @@ class DummyEndpoint { } } -class TestCreateAssociationRequest extends PHPUnit_TestCase { +class TestCreateAssociationRequest extends PHPUnit_Framework_TestCase { function setUp() { $this->endpoint = new DummyEndpoint(); @@ -2354,7 +2351,7 @@ class TestCreateAssociationRequest extends PHPUnit_TestCase { } } -class TestDiffieHellmanResponseParameters extends PHPUnit_TestCase { +class TestDiffieHellmanResponseParameters extends PHPUnit_Framework_TestCase { var $session_cls = null; var $message_namespace = null; @@ -2454,7 +2451,7 @@ if (!defined('Auth_OpenID_NO_MATH_SUPPORT') && } } -class Tests_Auth_OpenID_KVPost extends PHPUnit_TestCase { +class Tests_Auth_OpenID_KVPost extends PHPUnit_Framework_TestCase { function setUp() { $this->server_url = 'http://unittest/bogus'; |