index->pageIndexAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'
Zutenis | Sākums',
'Laipni lūgti grāmatvedības sistēmā ZUTENIS
',
'Atsauksmes
',
'Pakalpojumi
',
'Mēs esam radoši
',
'Grāmatvedības sistēma
',
],
$pageHTML
);
// Scroll param added
$this->setGet(['scroll_to' => '#fh5co-intro']);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['Redirected to Location:'],
$error->getMessage()
);
}
}
public function testIndexPageRequestFileDownloadAction(): void
{
$oCry = new cDefuseCrypto();
$this->setGet([
'action' => 'file',
'f' => $oCry->encrypt(71),
'p' => true
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['Redirected to Location:'],
$error->getMessage()
);
}
// Delete user cfg
$id = $this->cDb->_queryInsert(
'mod_articles_files',
[
'ref_id' => 0,
'file_name' => 'TRANZAKCIJU_IMPORTS.xlsx',
'file_link' => '/company/doc_logo/8412e9930cf0cc07800ffa5977ebe0e1d717374c.png',
'file_disabled' => '0',
'file_order' => 0,
'file_type' => 2,
]
);
$this->setGet([
'action' => 'file',
'f' => $oCry->encrypt($id),
'p' => false
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['File Download: /var/www/html/www/files/company/doc_logo/8412e9930cf0cc07800ffa5977ebe0e1d717374c.png'],
$error->getMessage()
);
}
}
public function testIndexPageContactUsAction(): void
{
$this->setGet([
'action' => 'contact_us',
'data' => '{"name":"Title","email":"test@test.lv","phone":"123456789","message":"msg"}'
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"jsonok":true}'],
$error->getMessage()
);
}
// error case
$this->setGet([
'action' => 'contact_us',
'data' => '{"name":"","message":""}'
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['"error":true,"0":"fData","1"'],
$error->getMessage()
);
}
}
public function testIndexPageSubscribeAction(): void
{
$this->setGet([
'action' => 'subscribe',
'data' => ['sub_email' => 'test@test.lv']
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"jsonok":true}'],
$error->getMessage()
);
}
// Case 2
$this->setGet([
'action' => 'subscribe',
'data' => ['sub_email' => 'test2222@test.lv']
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"jsonok":true}'],
$error->getMessage()
);
}
// Error Case
$this->setGet([
'action' => 'subscribe',
'data' => ['sub_email' => '']
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"error":true,"msg":"Something went wrong!"}'],
$error->getMessage()
);
}
// Error Case 2
$this->setGet([
'action' => 'subscribe',
'data' => ['sub_email' => 'test@']
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"error":true,"msg":"Something went wrong!"}'],
$error->getMessage()
);
}
}
public function testIndexPageUnsubscribeAction(): void
{
$this->setGet([
'action' => 'unsubscribe',
'data' => ['sub_email' => 'test@test.lv']
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"jsonok":true}'],
$error->getMessage()
);
}
// Error case 1
$this->setGet([
'action' => 'unsubscribe',
'data' => ['sub_email' => 'test']
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"jsonok":true}'],
$error->getMessage()
);
}
// Error case 2
$this->setGet([
'action' => 'unsubscribe',
'data' => ['sub_email' => '']
]);
try {
$this->index->pageIndexAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"error":true,"msg":"Something went wrong!"}'],
$error->getMessage()
);
}
}
public function testPageUnSubscribeDefaultAction(): void
{
ob_start();
$this->index->pageUnSubscribeAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'Atcelt abonēšanu
',
'Kāpēc atrakstīties?
',
],
$pageHTML
);
$this->setGet([
'action' => 'unsubscribe',
'data' => ['sub_email' => 'test@test.lv']
]);
try {
$this->index->pageUnSubscribeAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"jsonok":true}'],
$error->getMessage()
);
}
// Error case 1
$this->setGet([
'action' => 'unsubscribe',
'data' => ['sub_email' => 'test']
]);
try {
$this->index->pageUnSubscribeAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"jsonok":true}'],
$error->getMessage()
);
}
// Error case 2
$this->setGet([
'action' => 'unsubscribe',
'data' => ['sub_email' => '']
]);
try {
$this->index->pageUnSubscribeAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"error":true,"msg":"Something went wrong!"}'],
$error->getMessage()
);
}
}
public function testPageSubscribeActionDefaultAction(): void
{
ob_start();
$this->index->pageSubscribeAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'Abonēt
',
'Subscribe to our newsletters
',
],
$pageHTML
);
$this->setGet([
'action' => 'subscribe',
'data' => ['sub_email' => 'test@test.lv']
]);
try {
$this->index->pageSubscribeAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"jsonok":true}'],
$error->getMessage()
);
}
$this->setGet([
'action' => 'subscribe',
'data' => ['sub_email' => 'test222222@test.lv']
]);
try {
$this->index->pageSubscribeAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"jsonok":true}'],
$error->getMessage()
);
}
// Error case 1
$this->setGet([
'action' => 'subscribe',
'data' => ['sub_email' => 'test']
]);
try {
$this->index->pageSubscribeAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"error":true,"msg":"Something went wrong!"}'],
$error->getMessage()
);
}
// Error case 2
$this->setGet([
'action' => 'subscribe',
'data' => ['sub_email' => '']
]);
try {
$this->index->pageSubscribeAction();
$this->fail("Exception expected!");
} catch (Exception $error) {
$this->assertExpected(
['{"error":true,"msg":"Something went wrong!"}'],
$error->getMessage()
);
}
}
public function testPageAboutUsActionDefaultAction(): void
{
ob_start();
$this->index->pageAboutUsAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'Par mums
',
'Esam profesionāļi un pieredzējuši speciālisti ar efektīvu un izcilu darba ' .
'sniegumu, sniedzot mūsu sistēmas lietotājiem labāko risinājumu.
',
],
$pageHTML
);
}
public function testPageFAQActionDefaultAction(): void
{
ob_start();
$this->index->pageFAQAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'Biežāk uzdotie jautājumi
',
'Šeit jūs varat atrast dažus no mūsu bieži uzdotajiem jautājumiem
',
],
$pageHTML
);
}
public function testAgreeToTermsAction(): void
{
ob_start();
$this->index->agreeToTermsAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'Lietošanas noteikumi
',
'Spēkā no 2020. gada 1. janvāra
',
],
$pageHTML
);
}
public function testUserActivationAction(): void
{
ob_start();
$this->index->userActivationAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'Something went wrong while activating your account!
'
],
$pageHTML
);
}
public function testPageDisclaimersAction(): void
{
ob_start();
$this->index->pageDisclaimersAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'Atruna
',
'Disclaimer short description
',
],
$pageHTML
);
}
public function testPageCopyRightsAction(): void
{
ob_start();
$this->index->pageCopyRightsAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'Autortiesības
',
'Spēkā no 2019. gada 1. jūnija
',
],
$pageHTML
);
}
public function testPageAccessErrorAction(): void
{
ob_start();
$this->index->pageAccessErrorAction();
$pageHTML = ob_get_contents();
ob_end_clean();
$this->assertExpected(
[
'Piekļuves kļūda
',
],
$pageHTML
);
}
public function testBlankAction(): void
{
ob_start();
$this->assertTrue($this->index->blankAction());
$pageHTML = ob_get_contents();
ob_end_clean();
}
}