I'd like to write WebTestCase of views that requires authentification. Is it possible? How can I pass authentification?
I tried with writing basic authentification in the session but it doesn't work.
$_SESSION['Auth']['User']['id'] = 1;
$_SESSION['Auth']['User']['username'] = 'nico';
function login() {
$this->get($this->host_name."/users/login/");
$this->assertText("Login");
$this->setField("data[User][username]",'xxxx');
$this->setField("data[User][password]",'xxxx');
$this->assertClickable("login");
$this->clickSubmit("login");
$this->assertNoText("Error:");
}