72 lines
1.9 KiB
PHP
72 lines
1.9 KiB
PHP
<?php
|
|
|
|
namespace LoretaAudit\Tests\UnitTests\App\PubUsers;
|
|
|
|
use BRSystems\Core\Cms\cmsAccountManager\inc\cmsAccountManagerController;
|
|
use Exception;
|
|
use BRSystems\Core\App\pubUsers\pubUsers;
|
|
use LoretaAudit\Tests\BasePhpUnitCase;
|
|
use LoretaAudit\Tests\DataSetup\Constants\SiteMap;
|
|
|
|
class pubUsersControllerTest extends BasePhpUnitCase
|
|
{
|
|
private pubUsers $users;
|
|
private pubUsers $pubUserLogin;
|
|
|
|
protected function setUp(): void
|
|
{
|
|
// Init base structure
|
|
$this->unitTestsAreRunning = true;
|
|
$this->resetGetAndPost();
|
|
parent::setUp();
|
|
|
|
// Create new class
|
|
$this->partners = $this->initBaseClassObjectBySiteMapId(SiteMap::PUB_SEL_COMPANY);
|
|
$this->users = new pubUsers(getFirstMatchByMapId(SiteMap::PUB_LOGIN));
|
|
}
|
|
|
|
protected function tearDown(): void
|
|
{
|
|
$this->reloadDbTables(['mod_users']);
|
|
$this->logOutUnitTestUser();
|
|
parent::tearDown();
|
|
}
|
|
|
|
public function testChkLogoutStatus(): void
|
|
{
|
|
$this->setGet(['logout' => 1]);
|
|
|
|
try {
|
|
$this->users->controller->chkLogOut();
|
|
$this->fail('Exception Expected!');
|
|
} catch (Exception $error) {
|
|
$this->assertExpected(
|
|
['Redirected to Location:'],
|
|
$error->getMessage()
|
|
);
|
|
}
|
|
}
|
|
|
|
public function testChkLogOut(): void
|
|
{
|
|
$this->setGet(['logout' => 1]);
|
|
|
|
try {
|
|
$this->users->controller->chkLogOut();
|
|
$this->fail('Exception Expected!');
|
|
} catch (Exception $error) {
|
|
$this->assertExpected(
|
|
['Redirected to Location:'],
|
|
$error->getMessage()
|
|
);
|
|
}
|
|
}
|
|
|
|
public function testSaveProfileCfgProp(): void
|
|
{
|
|
$this->assertTrue(
|
|
$this->users->controller->saveProfileCfgProp('bUseDarkMode', 1)
|
|
);
|
|
}
|
|
}
|