1
0
mirror of https://github.com/e107inc/e107.git synced 2025-08-15 02:57:15 +02:00

Simple login test added.

This commit is contained in:
Cameron
2021-01-11 15:14:56 -08:00
parent 78a70b687d
commit 67e7823a60
3 changed files with 97 additions and 7 deletions

View File

@@ -0,0 +1,78 @@
<?php
class userloginTest extends \Codeception\Test\Unit
{
/** @var userlogin */
protected $lg;
protected function _before()
{
try
{
$this->lg = $this->make('userlogin');
}
catch(Exception $e)
{
$this->assertTrue(false, $e->getMessage());
}
$this->lg->__construct();
}
/*
public function testGetUserData()
{
}
public function testGetLookupQuery()
{
}
*/
public function testLogin()
{
$tests = array(
0 => array(
'username' => 'invalid_user',
'userpass' => '',
'autologin' => 0,
'noredirect' => true,
'response' => '',
'_expected_' => false
),
1 => array(
'username' => 'e107',
'userpass' => 'e107',
'autologin' => 0,
'noredirect' => true,
'response' => '',
'_expected_' => true
),
);
foreach($tests as $var)
{
$result = $this->lg->login($var['username'], $var['userpass'], $var['autologin'], $var['response'], $var['noredirect']);
$this->assertSame($var['_expected_'], $result);
}
}
public function testErrorMessages()
{
$result = $this->lg->test();
foreach($result as $var)
{
$this->assertNotEmpty($var);
}
}
}