From: Gunnar Wrobel Date: Wed, 1 Dec 2010 20:17:25 +0000 (+0100) Subject: Convert the Horde_Auth_Passwd test to PHPUnit. X-Git-Url: https://git.internetallee.de/?a=commitdiff_plain;h=398f56c1335d1415b705ebc4cbb942b1ff777a5f;p=horde.git Convert the Horde_Auth_Passwd test to PHPUnit. --- diff --git a/framework/Auth/test/Horde/Auth/Unit/PasswdTest.php b/framework/Auth/test/Horde/Auth/Unit/PasswdTest.php new file mode 100644 index 000000000..de929da6f --- /dev/null +++ b/framework/Auth/test/Horde/Auth/Unit/PasswdTest.php @@ -0,0 +1,53 @@ + + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Auth + */ + +/** + * Prepare the test setup. + */ +require_once dirname(__FILE__) . '/../Autoload.php'; + +/** + * Test the Horde_Auth:: class. + * + * Copyright 2010 The Horde Project (http://www.horde.org/) + * + * See the enclosed file COPYING for license information (LGPL). If you + * did not receive this file, see http://www.fsf.org/copyleft/lgpl.html. + * + * @category Horde + * @package Auth + * @subpackage UnitTests + * @author Gunnar Wrobel + * @license http://www.fsf.org/copyleft/lgpl.html LGPL + * @link http://pear.horde.org/index.php?package=Auth + */ +class Horde_Auth_Unit_PasswdTest extends Horde_Auth_TestCase +{ + public function setUp() + { + $this->driver = new Horde_Auth_Passwd( + array('filename' => dirname(__FILE__) . '/../fixtures/test.passwd') + ); + } + + public function testAuthenticate() + { + $this->assertTrue($this->driver->authenticate('user', array('password' => 'password'))); + } + + public function testListUsers() + { + $this->assertEquals(array('user'), $this->driver->listUsers()); + } +} \ No newline at end of file diff --git a/framework/Auth/test/Horde/Auth/fixtures/test.passwd b/framework/Auth/test/Horde/Auth/fixtures/test.passwd new file mode 100644 index 000000000..0ff58ae1e --- /dev/null +++ b/framework/Auth/test/Horde/Auth/fixtures/test.passwd @@ -0,0 +1 @@ +user:3U6GxZSGmKPGA diff --git a/framework/Auth/test/Horde/Auth/passwd.phpt b/framework/Auth/test/Horde/Auth/passwd.phpt deleted file mode 100644 index ddffc2792..000000000 --- a/framework/Auth/test/Horde/Auth/passwd.phpt +++ /dev/null @@ -1,24 +0,0 @@ ---TEST-- -Horde_Auth_Passwd:: test ---FILE-- - dirname(__FILE__) . '/test.passwd')); - -// List users -var_dump($auth->listUsers()); - -// Authenticate -var_dump($auth->authenticate('user', array('password' => 'password'))); - -?> ---EXPECT-- -array(1) { - [0]=> - string(4) "user" -} -bool(true) diff --git a/framework/Auth/test/Horde/Auth/test.passwd b/framework/Auth/test/Horde/Auth/test.passwd deleted file mode 100644 index 0ff58ae1e..000000000 --- a/framework/Auth/test/Horde/Auth/test.passwd +++ /dev/null @@ -1 +0,0 @@ -user:3U6GxZSGmKPGA