resetGetAndPost(); $this->reloadDbTables( [ 'mod_account_manager', 'mod_account_permissions', 'mod_account_to_bills', 'mod_account_to_create', 'mod_account_to_users', ] ); } public function testPageRegisterActionDefaultAction(): void { ob_start(); $this->index->pageRegisterAction(); $pageHTML = ob_get_contents(); ob_end_clean(); $this->assertExpected( [ '

Reģistrācija

', 'Aizpildiet zemāk atrodošo reģistrācijas veidlapu un sāciet izmantot mūsu sistēmu jau šodien!', ], $pageHTML ); } public function testPageRegisterActionCnaAction(): void { $this->setGet([ 'action' => 'cna', 'data' => '{"acc_name":"test+marekas","reg_nr":"12345677890","chkVat":false,"chkMicro":false,"a_type":"1",' . '"document_system":false,"uid":"","login":"tt@tttttt.lv","name":"mm","surname":"tt",' . '"email":"tt@tttttt.lv","phone":"1234567890","chkAgree":true,"chkSubscribe":true}' ]); try { $this->index->pageRegisterAction(); $this->fail("Exception expected!"); } catch (Exception $error) { $this->assertExpected( ['{"jsonok":true,"data":true}'], $error->getMessage() ); } // Error case $this->setGet([ 'action' => 'cna', 'data' => '{"acc_name":"test+marekas","reg_nr":"12345677890","chkVat":false,"chkMicro":false,"a_type":"1",' . '"document_system":false,"uid":"","login":"tt@tttttt.lv","name":"mm","surname":"tt",' . '"email":"tt@tttttt.lv","phone":"1234567890","chkAgree":true,"chkSubscribe":true}' ]); try { $this->index->pageRegisterAction(); $this->fail("Exception expected!"); } catch (Exception $error) { $this->assertExpected( ['{"error":true,"data":{"email":"Lietot\u0101js ar \u0161o e-pastu jau ir re\u0123istr\u0113ts!"'], $error->getMessage() ); } } public function testPageRegisterActionCnaActionError(): void { $this->setGet([ 'action' => 'cna', 'data' => '{"acc_name":"test+marekas","reg_nr":"12345677890","chkVat":false,"chkMicro":false,"a_type":"1",' . '"document_system":false,"uid":"","login":"keiss.mareks@gmail.com","name":"mm","surname":"tt",' . '"email":"keiss.mareks@gmail.com","phone":"1234567890","chkAgree":true,"chkSubscribe":true}' ]); try { $this->index->pageRegisterAction(); $this->fail("Exception expected!"); } catch (Exception $error) { $this->assertExpected( ['{"error":true,"data":{"email":"Lietot\u0101js ar \u0161o e-pastu jau ir re\u0123istr\u0113ts!"}}'], $error->getMessage() ); } } }