public function testMethods()
 {
     // Clear validations
     \model\ValidationService::Clear();
     $appSettings = $this->setupAppsettings();
     // Create app mockup object with properties
     $appMockup = new \stdClass();
     $appMockup->htmlView = new \stdClass();
     // Create ctrl helper class
     $ctrlHelper = new \model\CtrlHelperService($appMockup, $appSettings);
     // Ctrl to string method
     $CtrlString = $ctrlHelper->CtrlToString(new \controller\PageCtrl($ctrlHelper));
     $this->assertEquals("page", $CtrlString);
     // ProcessUrl method
     // $ctrlHelper->ProcessUrl('/page/leading/somewhere'); Not testable
     // Execute controller method
     $ctrlHelper->ExecuteController(new DummyClass(), "DummyMethod", ["someParam"]);
     // A new flashmessage should be added.
     $this->assertTrue(\model\FlashMessageService::DoesExist());
     // Clear flashmessage
     \model\FlashMessageService::Clear();
     $riskyFile = '/etc/passwd';
     // Load methods
     $this->assertFalse($ctrlHelper->LoadController($riskyFile));
     $this->assertFalse($ctrlHelper->LoadBLLModel($riskyFile));
     $this->assertFalse($ctrlHelper->LoadDALModel($riskyFile));
     $this->assertFalse($ctrlHelper->LoadService($riskyFile));
     $this->assertFalse($ctrlHelper->LoadView($riskyFile));
     // Create methods
     $this->assertFalse($ctrlHelper->CreateController($riskyFile));
     $this->assertFalse($ctrlHelper->CreateBLLModel($riskyFile));
     $this->assertFalse($ctrlHelper->CreateDALModel($riskyFile));
     $this->assertFalse($ctrlHelper->CreateService($riskyFile));
     $this->assertFalse($ctrlHelper->CreateView($riskyFile));
 }
Exemplo n.º 2
0
 private function RenderMsg()
 {
     // Get exception messages if there are any.
     if (\model\ExceptionsService::HasExceptions()) {
         echo $this->LoadTemplate('MessageTpl', [\model\ExceptionsService::GetLastExceptionMessage()]);
     } else {
         if (\model\FlashMessageService::DoesExist()) {
             echo $this->LoadTemplate('MessageTpl', \model\FlashMessageService::GetAll());
         }
     }
 }
 public function GetHTML()
 {
     $messageToUser = '';
     // Get exception messages if there are any.
     if (\model\ExceptionsService::HasExceptions()) {
         foreach (\model\ExceptionsService::GetAllExceptionMessages() as $message) {
             $messageToUser .= $message . "<br>";
         }
     } else {
         if (!\model\ValidationService::IsValid()) {
             foreach (\model\ValidationService::GetValidationErrors() as $message) {
                 $messageToUser .= $message . "<br>";
             }
         } else {
             if (\model\FlashMessageService::DoesExist()) {
                 $messageToUser .= \model\FlashMessageService::Get();
             }
         }
     }
     // Get output
     return $this->GetRegisterFormOutput($messageToUser);
 }
Exemplo n.º 4
0
 public function GetHTML()
 {
     $messageToUser = '';
     // Get exception messages if there are any.
     if (\model\ExceptionsService::HasExceptions()) {
         $messageToUser = \model\ExceptionsService::GetLastExceptionMessage();
     } else {
         if (!\model\ValidationService::IsValid()) {
             foreach (\model\ValidationService::GetValidationErrors() as $message) {
                 $messageToUser .= $message . "<br>";
             }
         } else {
             if (\model\FlashMessageService::DoesExist()) {
                 $messageToUser = \model\FlashMessageService::Get();
             }
         }
     }
     // Get login or logout form output
     return $this->auth->IsUserLoggedIn() ? $this->GetLogoutFormOutput($messageToUser) : $this->GetLoginFormOutput($messageToUser);
 }