restart() public method

It flushes history and all cookies.
public restart ( )
 protected function login(Client $client, $username = '******', $password = '******')
 {
     $client->restart();
     $crawler = $client->request('GET', '/login');
     $this->assertTrue($client->getResponse()->isSuccessful(), 'Response should be successful');
     $form = $crawler->selectButton('Login')->form();
     $client->submit($form, array('_username' => $username, '_password' => $password));
     $this->assertTrue($client->getResponse()->isRedirect(), 'Response should be redirect');
     $crawler = $client->followRedirect();
     $this->assertGreaterThan(0, $crawler->filter('html:contains("Benvenuto")')->count());
 }
示例#2
0
文件: Client.php 项目: fabpot/goutte
 /**
  * {@inheritdoc}
  */
 public function restart()
 {
     parent::restart();
     $this->resetAuth()->resetHeaders();
 }