FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
BookStack/tests/Unit/FrameworkAssumptionTest.php at development · ucoding/BookStack · GitHub
ucoding
/
BookStack
Public
forked from
BookStackApp/BookStack
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
BookStack
/
tests
/
Unit
/
FrameworkAssumptionTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
31 lines (27 loc) · 1.09 KB
Breadcrumbs
BookStack
/
tests
/
Unit
/
FrameworkAssumptionTest.php
Copy path
File metadata and controls
31 lines (27 loc) · 1.09 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
<?php
namespace
Tests
\
Unit
;
use
BadMethodCallException
;
use
BookStack
\
Entities
\
Models
\
Page
;
use
Tests
\
TestCase
;
/**
* This class tests assumptions we're relying upon in the framework.
* This is primarily to keep track of certain bits of functionality that
* may be used in important areas such as to enforce permissions.
*/
class
FrameworkAssumptionTest
extends
TestCase
{
public
function
test_scopes_error_if_not_existing
()
{
$
this
->
expectException
(BadMethodCallException::class);
$
this
->
expectExceptionMessage
(
'
Call to undefined method BookStack\Entities\Models\Page::scopeNotfoundscope()
'
);
Page::
query
()->
scopes
(
'
notfoundscope
'
);
}
public
function
test_scopes_applies_upon_existing
()
{
// Page has SoftDeletes trait by default, so we apply our custom scope and ensure
// it stacks on the global scope to filter out deleted items.
$
query
= Page::
query
()->
scopes
(
'
visible
'
)->
toSql
();
$
this
->
assertStringContainsString
(
'
joint_permissions
'
,
$
query
);
$
this
->
assertStringContainsString
(
'
`deleted_at` is null
'
,
$
query
);
}
}
Back
|
FazBrowse Home
|
New Git URL