AppFixtures::USERNAME_USER, 'PHP_AUTH_PW' => AppFixtures::DEFAULT_PASSWORD, ]); return $client; } /** * @param Client $client * @param string $url * @param string $method * @return \Symfony\Component\DomCrawler\Crawler */ protected function request(Client $client, string $url, $method = 'GET') { return $client->request($method, '/' . self::DEFAULT_LANGUAGE . $url); } /** * @param string $url * @param string $method */ protected function assertUrlIsSecured(string $url, $method = 'GET') { $client = self::createClient(); $client->request($method, '/' . self::DEFAULT_LANGUAGE . $url); $this->assertTrue($client->getResponse()->isRedirect()); $this->assertEquals( 'http://localhost/' . self::DEFAULT_LANGUAGE . '/login', $client->getResponse()->getTargetUrl(), sprintf('The %s secure URL redirects to the login form.', $url) ); } /** * @param Client $client */ protected function assertRouteNotFound(Client $client) { $this->assertFalse($client->getResponse()->isSuccessful()); $this->assertEquals(404, $client->getResponse()->getStatusCode()); } }