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:
parent
e9d1cd6fe7
commit
c0c4ebe0d0
5 changed files with 23 additions and 4 deletions
|
|
@ -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');
|
||||
});
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
---
|
||||
slug: example
|
||||
title: 'Test page'
|
||||
updated_at: 2021-08-06T02:25:15+00:00
|
||||
created_at: 2021-08-06T02:25:15+00:00
|
||||
updated_at: 2021-08-08T18:00:46+00:00
|
||||
created_at: 2021-08-08T18:00:46+00:00
|
||||
---
|
||||
This is a test page
|
||||
|
|
@ -1,7 +1,8 @@
|
|||
---
|
||||
slug: test
|
||||
title: 'Test page'
|
||||
updated_at: 2021-08-06T02:25:15+00:00
|
||||
created_at: 2021-08-06T02:25:15+00:00
|
||||
password: foo
|
||||
updated_at: 2021-08-08T18:00:46+00:00
|
||||
created_at: 2021-08-08T18:00:46+00:00
|
||||
---
|
||||
This is a test page
|
||||
Loading…
Add table
Add a link
Reference in a new issue