FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
BookStack/tests/Entity/EntityAccessTest.php at development · BookStackApp/BookStack · GitHub
Uh oh!
There was an error while loading.
Please reload this page
.
BookStackApp
/
BookStack
Public
Uh oh!
There was an error while loading.
Please reload this page
.
Notifications
You must be signed in to change notification settings
Fork
2.4k
Star
19k
Code
Issues
0
Pull requests
1
Security and quality
8
Insights
Additional navigation options
Code
Issues
Pull requests
Security and quality
Insights
Expand file tree
Breadcrumbs
BookStack
/
tests
/
Entity
/
EntityAccessTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
51 lines (43 loc) · 1.63 KB
Breadcrumbs
BookStack
/
tests
/
Entity
/
EntityAccessTest.php
Copy path
File metadata and controls
51 lines (43 loc) · 1.63 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
<?php
namespace
Tests
\
Entity
;
use
BookStack
\
Entities
\
Models
\
Entity
;
use
BookStack
\
Users
\
UserRepo
;
use
Tests
\
TestCase
;
class
EntityAccessTest
extends
TestCase
{
public
function
test_entities_viewable_after_creator_deletion
()
{
// Create required assets and revisions
$
creator
=
$
this
->
users
->
editor
();
$
updater
=
$
this
->
users
->
viewer
();
$
entities
=
$
this
->
entities
->
createChainBelongingToUser
(
$
creator
,
$
updater
);
app
()->
make
(UserRepo::class)->
destroy
(
$
creator
);
$
this
->
entities
->
updatePage
(
$
entities
[
'
page
'
], [
'
html
'
=>
'
<p>hello!</p>>
'
]);
$
this
->
checkEntitiesViewable
(
$
entities
);
}
public
function
test_entities_viewable_after_updater_deletion
()
{
// Create required assets and revisions
$
creator
=
$
this
->
users
->
viewer
();
$
updater
=
$
this
->
users
->
editor
();
$
entities
=
$
this
->
entities
->
createChainBelongingToUser
(
$
creator
,
$
updater
);
app
()->
make
(UserRepo::class)->
destroy
(
$
updater
);
$
this
->
entities
->
updatePage
(
$
entities
[
'
page
'
], [
'
html
'
=>
'
<p>Hello there!</p>
'
]);
$
this
->
checkEntitiesViewable
(
$
entities
);
}
/**
* @param array<string, Entity> $entities
*/
private
function
checkEntitiesViewable
(
array
$
entities
)
{
// Check pages and books are visible.
$
this
->
asAdmin
();
foreach
(
$
entities
as
$
entity
) {
$
this
->
get
(
$
entity
->
getUrl
())
->
assertStatus
(
200
)
->
assertSee
(
$
entity
->
name
);
}
// Check revision listing shows no errors.
$
this
->
get
(
$
entities
[
'
page
'
]->
getUrl
(
'
/revisions
'
))->
assertStatus
(
200
);
}
}
Back
|
FazBrowse Home
|
New Git URL