1
0
Fork 0
mirror of https://github.com/archtechx/laravel-pages.git synced 2025-12-12 01:44:03 +00:00

Add password protected pages (resolve #3)

This commit is contained in:
Samuel Štancl 2021-08-08 20:01:14 +02:00
parent e9d1cd6fe7
commit c0c4ebe0d0
5 changed files with 23 additions and 4 deletions

View file

@ -77,3 +77,16 @@ test('SEO metadata is set on markdown pages', function () {
->assertSee('<meta property="og:title" content="Test page" />', false)
->assertSee('<meta property="og:description" content="This is a test page" />', false);
});
test('pages can be password-protected', function () {
Page::create([
'slug' => 'test',
'title' => 'Test page',
'password' => 'foo',
'content' => 'This is a test page'
]);
using($this)->get('/test')->assertForbidden();
using($this)->get('/test?password=bar')->assertForbidden();
using($this)->get('/test?password=foo')->assertSuccessful()->assertSee('This is a test page');
});