diff options
author | Cash Costello <cash.costello@gmail.com> | 2011-12-11 06:38:23 -0500 |
---|---|---|
committer | Cash Costello <cash.costello@gmail.com> | 2011-12-11 06:38:23 -0500 |
commit | d9bf22a0e29c2a70049443a0ae8521a2c0492c8b (patch) | |
tree | c7599a9169d5def7df56c480ad6d67f312443d6f /models/openid-php-openid-782224d/Tests/Auth/OpenID/URINorm.php | |
download | elgg-d9bf22a0e29c2a70049443a0ae8521a2c0492c8b.tar.gz elgg-d9bf22a0e29c2a70049443a0ae8521a2c0492c8b.tar.bz2 |
initial commit for git repository
Diffstat (limited to 'models/openid-php-openid-782224d/Tests/Auth/OpenID/URINorm.php')
-rw-r--r-- | models/openid-php-openid-782224d/Tests/Auth/OpenID/URINorm.php | 66 |
1 files changed, 66 insertions, 0 deletions
diff --git a/models/openid-php-openid-782224d/Tests/Auth/OpenID/URINorm.php b/models/openid-php-openid-782224d/Tests/Auth/OpenID/URINorm.php new file mode 100644 index 000000000..b79b7802b --- /dev/null +++ b/models/openid-php-openid-782224d/Tests/Auth/OpenID/URINorm.php @@ -0,0 +1,66 @@ +<?php + +/** + * Tests for the URI normalization routines used by the OpenID + * library. + * + * PHP versions 4 and 5 + * + * LICENSE: See the COPYING file included in this distribution. + * + * @package OpenID + * @author JanRain, Inc. <openid@janrain.com> + * @copyright 2005-2008 Janrain, Inc. + * @license http://www.apache.org/licenses/LICENSE-2.0 Apache + */ + +require_once 'Auth/OpenID/URINorm.php'; +require_once 'Tests/Auth/OpenID/TestUtil.php'; + +class Tests_Auth_OpenID_URINorm_TestCase extends PHPUnit_Framework_TestCase { + function Tests_Auth_OpenID_URINorm_TestCase( + $name, $uri, $expected) + { + + $this->setName($name); + $this->uri = $uri; + $this->expected = $expected; + } + + function runTest() + { + $actual = Auth_OpenID_urinorm($this->uri); + $this->assertEquals($this->expected, $actual); + } +} + +class Tests_Auth_OpenID_URINorm extends PHPUnit_Framework_TestSuite { + function _readTestCases() + { + $lines = Tests_Auth_OpenID_readlines('urinorm.txt'); + $cases = array(); + $case = array(); + for ($i = 0; $i < count($lines) && ($i + 3 <= count($lines)); $i += 4) { + $name = trim($lines[$i]); + $uri = trim($lines[$i + 1]); + $expected = trim($lines[$i + 2]); + if ($expected == 'fail') { + $expected = null; + } + $cases[] = array($name, $uri, $expected); + } + + return $cases; + } + + function Tests_Auth_OpenID_URINorm($name) + { + $this->setName($name); + $cases = $this->_readTestCases(); + foreach ($cases as $case) { + list($name, $uri, $expected) = $case; + $this->addTest(new Tests_Auth_OpenID_URINorm_TestCase($name, $uri, $expected)); + } + } +} + |