Ejemplo n.º 1
0
 /**
  * Check if logs are writeable
  * @group Installation 
  */
 public function testLogDir()
 {
     info("\tTesting log write-access for web user\n");
     $root = AgaviConfig::get("core.root_dir");
     $logDir = $root . "/log";
     $wwwUser = IcingaWebTestTool::getProperty('www-user');
     $wwwGroup = IcingaWebTestTool::getProperty('www-group');
     $command = "touch " . $logDir . "/testfile.txt";
     if (!function_exists('posix_getuid') || posix_getuid() == 0) {
         $command = "su " . $wwwUser . " -c '" . $command . "'";
     }
     exec($command);
     if (!file_exists($logDir . "/testfile.txt")) {
         error("Web user " . $wwwUser . " couldn't create logfile in " . $logDir . "Please check that the either the user " . $wwwUser . " or the group " . $wwwGroup . " has " . "write access to this folder - otherwise icinga-web won't work\n");
         $this->fail("Couldn't write log files");
     } else {
         success("\tLog-directory is writeable for wwwGroup!\n");
     }
 }
Ejemplo n.º 2
0
 /**
  * @depends testShowLoginMask
  * @group Interface
  */
 public function testCorrectLogin()
 {
     info("\tTesting correct login\n");
     $root = AgaviConfig::get("core.root_dir");
     $params = new AgaviRequestDataHolder();
     $params->setParameters(array("dologin" => 1, "password" => IcingaWebTestTool::getProperty('testLogin-pass'), "username" => IcingaWebTestTool::getProperty('testLogin-name')));
     $ctx = AgaviContext::getInstance('web');
     $container = $ctx->getController()->createExecutionContainer("AppKit", "Login.AjaxLogin", $params, "json", "write");
     $json = null;
     try {
         $result = $container->execute();
         $json = json_decode($result->getContent(), true);
         if (!$json) {
             throw new Exception("Invalid result given " . $result->getContent());
         }
     } catch (Exception $e) {
         $this->fail("Login threw an exception " . $e->getMessage());
     }
     if (!$json["success"]) {
         $this->fail("Login failed with test credentials. Please check the credentials in test.properties");
     }
     success("\tLogin successful\n");
 }