/** * Cookie should not be accepted if it has expired. */ public function testCookieExpiration() { // Set old authentication cookie. CookieTestHelper::setAuthenticationCookie($this->client, time() - 360 * 24 * 3600); // Visit login page. $crawler = $this->client->request('GET', '/settings/login'); // Assert there is a form. $buttonNode = $crawler->selectButton('login_submit'); $this->assertSame(1, $buttonNode->count(), 'There should be a form'); }
/** * When user is logged in, and he selects profile, then settings container must receive that choice. */ public function testSettingsSelected() { // Set authentication cookie. CookieTestHelper::setAuthenticationCookie($this->client); // Retrieve content. $crawler = $this->client->request('GET', '/settings/settings'); // Submit domain selection. $buttonNode = $crawler->selectButton('settings_submit'); $form = $buttonNode->form(); /** @noinspection PhpUndefinedMethodInspection */ $form['settings[ongr_settings_profile_profile_foo-2e-com]']->tick(); $this->client->submit($form); // Load any url and check that user selected domains are loaded. $this->client->request('GET', '/settings/setting/name0/edit'); $settingsContainer = $this->client->getContainer()->get('ongr_settings.settings_container'); $selectedDomains = $settingsContainer->getProfiles(); $this->assertEquals(['default', 'profile_foo.com'], $selectedDomains); }