Example #1
0
 public function testGetParamsAuthenticationWorksProperly()
 {
     global $phpRackConfig;
     $authArray = array('auth' => array('username' => uniqid(), 'password' => uniqid()));
     // Injecting values into config
     $authArray = array_merge($phpRackConfig, $authArray);
     // Removing htaccess authentication in case it is set
     if (array_key_exists('htpasswd', $authArray)) {
         unset($authArray['htpasswd']);
     }
     // Creating instance of Runner to test it with our config
     $runner = new phpRack_Runner($authArray);
     $_GET[phpRack_Runner_Auth::GET_LOGIN] = $authArray['auth']['username'];
     $_GET[phpRack_Runner_Auth::GET_PWD] = $authArray['auth']['password'];
     $this->assertTrue($runner->getAuth()->isAuthenticated(), 'Invalid auth using get parameters (Phing bridge)');
 }
Example #2
0
 require_once PHPRACK_PATH . '/View.php';
 // if it's CLI environment - just show a full test report
 if ($runner->isCliEnvironment()) {
     throw new Exception($runner->runSuite());
 }
 // check whether SSL connection is mandatory?
 if (!$runner->isEnoughSecurityLevel()) {
     throw new Exception('You must use SSL protocol to run integration tests');
 }
 /**
  * Using this tag in GET URL we can get a summary report
  * in plain text format.
  */
 if (array_key_exists('suite', $_GET)) {
     header('Content-Type: text/plain');
     if (!$runner->getAuth()->isAuthenticated()) {
         throw new Exception('Access denied');
     }
     throw new Exception($runner->runSuite());
 }
 // Global layout is required, show the front web page of the report
 if (empty($_GET[PHPRACK_AJAX_TAG])) {
     $view = new phpRack_View();
     // show login form, if the user is not authenticated yet
     if (!$runner->getAuth()->isAuthenticated()) {
         $view->assign(array('authResult' => $runner->getAuth()->getAuthResult()));
         throw new Exception($view->render('login.phtml'));
     }
     $view->assign(array('runner' => $runner));
     /**
      * @todo #57 this line leads to the problem explained in the ticket,