unitTestsAreRunning = true; $this->resetGetAndPost(); parent::setUp(); // Create new class $this->users = $this->initBaseClassObjectBySiteMapId(SiteMap::PUB_LOGIN, null); } protected function tearDown(): void { $this->reloadDbTables(['mod_users']); parent::tearDown(); } public function testUserAccountActivationViaLinkOnActivatedUser(): void { $loginData = $this->getLoginCredentialsByType(siteUsers::loginAppSelfEmployed); $this->setGet([ 'act' => $this->users->controller->oDefuseCrypt->encrypt( $loginData['id'] . cmsAccountActivationController::ACTIVATION_LINK_SEP . $this->users->controller->oDefuseCrypt->encrypt($loginData['password']) ) ]); try { $this->users->loginAction(); $this->fail('Exception Expected!'); } catch (Exception $error) { $this->assertExpected( ['Redirected to Location: /ienakt-gramatvedibas-sistema'], $error->getMessage() ); } } public function testUserAccountActivationViaLinkWhileLoggedIn(): void { $this->loginUnitTestUserForCoverage(); $loginData = $this->getLoginCredentialsByType(siteUsers::loginAppSelfEmployed); // Set user not activated $this->cDb->_queryUpdate('mod_users', ['user_activated' => '0'], ['id' => $loginData['id']]); $this->setGet([ 'act' => $this->users->controller->oDefuseCrypt->encrypt( $loginData['id'] . cmsAccountActivationController::ACTIVATION_LINK_SEP . $loginData['password'] ) ]); try { $this->users->loginAction(); $this->fail('Exception Expected!'); } catch (Exception $error) { $this->assertEquals( 'Redirected to Location: /ienakt-gramatvedibas-sistema/divi-faktori', $error->getMessage() ); } $this->logOutUnitTestUser(); } }