Skip to content

Commit 03791d1

Browse files
authored
Merge pull request #12 from milwad-dev/add-test-for-create-security-cookie-controller
2 parents 29098ce + e56ab0a commit 03791d1

File tree

1 file changed

+18
-0
lines changed

1 file changed

+18
-0
lines changed
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
<?php
2+
3+
it('create security cookie', function () {
4+
$response = $this->get('_native/api/cookie')->assertRedirect('/');
5+
$cookie = $response->headers->getCookies()[0];
6+
7+
$this->assertEquals('_php_native', $cookie->getName());
8+
$this->assertEquals('localhost', $cookie->getDomain());
9+
$this->assertTrue($cookie->isHttpOnly());
10+
});
11+
12+
it('check if secret is not equal of config secret key abort 403 page', function () {
13+
config()->set('native-php.secret', 'milwad');
14+
15+
$response = $this->get('_native/api/cookie')->assertStatus(403);
16+
17+
$this->assertEquals([], $response->headers->getCookies());
18+
});

0 commit comments

Comments
 (0)