/** * Scenario: As AN, I should be redirected to https if ssl.force parameter is set to true. * Given I am an anonymous user * When I am trying to access the login page * Then I should see that I am automatically redirected to the https version of it */ public function testSslRedirect() { PassboltServer::setExtraConfig(['App' => ['ssl' => ['force' => true]]]); $this->getUrl('auth/login'); $url = $this->driver->getCurrentURL(); try { $this->assertTrue(preg_match('/https.*\\/auth\\/login/', $url) === 1); } catch (Exception $e) { PassboltServer::resetExtraConfig(); throw $e; } PassboltServer::resetExtraConfig(); }
/** * Switch config to use primary domain (for multi domain testing). * * Switch will happen only if a first switch to secondary domain was done first. */ public function switchToPrimaryDomain() { // Switch needs to be done only if a switch to secondary domain was done first. if (Config::read('passbolt.url_primary')) { // Reset the config with the base url. Config::write('passbolt.url', Config::read('passbolt.url_primary')); PassboltServer::resetExtraConfig(); } }
/** * Executed after every tests */ protected function tearDown() { // Reset the selenium extra configuration. PassboltServer::resetExtraConfig(); parent::tearDown(); }