Update Tests to supports namespaces
This commit is contained in:
86
Tests/AuthsympaTest.php
Normal file
86
Tests/AuthsympaTest.php
Normal file
@@ -0,0 +1,86 @@
|
||||
<?php
|
||||
/** DomFramework - Tests
|
||||
* @package domframework
|
||||
* @author Dominique Fournier <dominique@fournier38.fr>
|
||||
* @license BSD
|
||||
*/
|
||||
|
||||
namespace Domframework\Tests;
|
||||
|
||||
/** Test the authentication on Sympa Service */
|
||||
class authsympaTest extends \PHPUnit_Framework_TestCase
|
||||
{
|
||||
public function test_connect_1 ()
|
||||
{
|
||||
// Empty
|
||||
$authsympa = new authsympa ();
|
||||
$this->expectException ();
|
||||
$authsympa->connect ();
|
||||
}
|
||||
|
||||
public function test_connect_2 ()
|
||||
{
|
||||
$authsympa = new authsympa ();
|
||||
$authsympa->wsdl = "https://listes.grenoble.cnrs.fr/sympa/wsdl";
|
||||
$authsympa->connect ();
|
||||
$res = $authsympa->getDetails ();
|
||||
$this->assertSame ($res, null);
|
||||
}
|
||||
|
||||
public function test_auth_1 ()
|
||||
{
|
||||
// Invalid password
|
||||
$authsympa = new authsympa ();
|
||||
$authsympa->wsdl = "https://listes.grenoble.cnrs.fr/sympa/wsdl";
|
||||
$authsympa->list = "listtest@listes.grenoble.cnrs.fr";
|
||||
$authsympa->connect ();
|
||||
$this->expectException ();
|
||||
$res = $authsympa->authentication ("richard.heral@grenoble.cnrs.fr", "XXXX");
|
||||
}
|
||||
|
||||
public function test_auth_2 ()
|
||||
{
|
||||
// Unknown user
|
||||
$authsympa = new authsympa ();
|
||||
$authsympa->wsdl = "https://listes.grenoble.cnrs.fr/sympa/wsdl";
|
||||
$authsympa->list = "listtest@listes.grenoble.cnrs.fr";
|
||||
$authsympa->connect ();
|
||||
$this->expectException ();
|
||||
$res = $authsympa->authentication ("Unknown@grenoble.cnrs.fr", "XXXX");
|
||||
}
|
||||
|
||||
public function test_auth_3 ()
|
||||
{
|
||||
// OK !
|
||||
$authsympa = new authsympa ();
|
||||
$authsympa->wsdl = "https://listes.grenoble.cnrs.fr/sympa/wsdl";
|
||||
$authsympa->list = "listtest@listes.grenoble.cnrs.fr";
|
||||
$authsympa->connect ();
|
||||
$res = $authsympa->authentication ("richard.heral@grenoble.cnrs.fr", "Lavchdn7!");
|
||||
$this->assertSame ($res, true);
|
||||
}
|
||||
|
||||
public function test_auth_4 ()
|
||||
{
|
||||
// Unknown list
|
||||
$authsympa = new authsympa ();
|
||||
$authsympa->wsdl = "https://listes.grenoble.cnrs.fr/sympa/wsdl";
|
||||
$authsympa->list = "unknown@listes.grenoble.cnrs.fr";
|
||||
$authsympa->connect ();
|
||||
$this->expectException ();
|
||||
$res = $authsympa->authentication ("richard.heral@grenoble.cnrs.fr", "Lavchdn8!");
|
||||
}
|
||||
|
||||
public function test_auth_5 ()
|
||||
{
|
||||
// User not in list
|
||||
$authsympa = new authsympa ();
|
||||
$authsympa->wsdl = "https://listes.grenoble.cnrs.fr/sympa/wsdl";
|
||||
$authsympa->list = "admins@listes.grenoble.cnrs.fr";
|
||||
$authsympa->connect ();
|
||||
$this->expectException ();
|
||||
$res = $authsympa->authentication ("richard.heral@grenoble.cnrs.fr", "Lavchdn8!");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user