3 require_once(dirname(__FILE__
).'/../../../fixtures/config/config.php');
5 class _AkActionController_http_authentication
extends AkWebTestCase
8 function test_should_access_public_action()
10 $this->setMaximumRedirects(0);
11 $this->get(AK_TESTING_URL
.'/authentication');
12 $this->assertResponse(200);
13 $this->assertTextMatch('Everyone can see me!');
16 function test_should_show_login_with_realm()
18 $this->setMaximumRedirects(0);
19 $this->get(AK_TESTING_URL
.'/authentication/edit');
20 $this->assertRealm('App name');
21 $this->assertNoText("I'm only accessible if you know the password");
24 function test_should_fail_login()
26 $this->setMaximumRedirects(0);
27 $this->get(AK_TESTING_URL
.'/authentication/edit');
28 $this->authenticate('bermi', 'badpass');
29 $this->assertResponse(401);
30 $this->assertNoText("I'm only accessible if you know the password");
33 function test_should_login()
35 $this->setMaximumRedirects(0);
36 $this->get(AK_TESTING_URL
.'/authentication/edit');
37 $this->authenticate('bermi', 'secret');
38 $this->assertResponse(200);
39 $this->assertText("I'm only accessible if you know the password");
42 $this->get(AK_TESTING_URL
.'/authentication/edit');
43 $this->assertResponse(200);
44 $this->assertText("I'm only accessible if you know the password");
50 ak_test('_AkActionController_http_authentication');