Add Tests for auth and authsympa
git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@5274 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
42
Tests/authTest.php
Normal file
42
Tests/authTest.php
Normal file
@@ -0,0 +1,42 @@
|
||||
<?php
|
||||
|
||||
/** Test the authentication */
|
||||
class test_auth extends PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_page_1 ()
|
||||
{
|
||||
$auth = new auth ();
|
||||
$res = $auth->pageHTML ("http://localhost");
|
||||
$this->assertSame (!! strpos ($res, "<form "), true);
|
||||
}
|
||||
|
||||
public function test_Message ()
|
||||
{
|
||||
$auth = new auth ();
|
||||
$res = $auth->pageHTML ("http://localhost", "MESSAGE");
|
||||
$this->assertSame (!! strpos ($res, "MESSAGE"), true);
|
||||
}
|
||||
|
||||
public function test_URL_1 ()
|
||||
{
|
||||
$auth = new auth ();
|
||||
$res = $auth->pageHTML ("http://localhost", "MESSAGE", "URL/TEST");
|
||||
$this->assertSame (!! strpos ($res, "URL/TEST"), true);
|
||||
}
|
||||
|
||||
public function test_alreadyAuth_1 ()
|
||||
{
|
||||
// Not Authenticated
|
||||
$auth = new auth ();
|
||||
$res = $auth->pageHTML ("http://localhost", "MESSAGE", "URL/TEST", false);
|
||||
$this->assertSame (!! strpos ($res, "Please sign in"), true);
|
||||
}
|
||||
|
||||
public function test_alreadyAuth_2 ()
|
||||
{
|
||||
// Authenticated
|
||||
$auth = new auth ();
|
||||
$res = $auth->pageHTML ("http://localhost", "", "", "AUTHENTICATED USER");
|
||||
$this->assertSame (!! strpos ($res, "AUTHENTICATED USER"), true);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user