FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
BookStack/tests/StatusTest.php at master · didphp/BookStack · GitHub
didphp
/
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
/
StatusTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
59 lines (51 loc) · 1.59 KB
Breadcrumbs
BookStack
/
tests
/
StatusTest.php
Copy path
File metadata and controls
59 lines (51 loc) · 1.59 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
52
53
54
55
56
57
58
59
<?php
use
Illuminate
\
Cache
\
ArrayStore
;
use
Illuminate
\
Support
\
Facades
\
Cache
;
use
Illuminate
\
Support
\
Facades
\
DB
;
use
Illuminate
\
Support
\
Facades
\
Session
;
use
Tests
\
TestCase
;
class
StatusTest
extends
TestCase
{
public
function
test_returns_json_with_expected_results
()
{
$
resp
=
$
this
->
get
(
'
/status
'
);
$
resp
->
assertStatus
(
200
);
$
resp
->
assertJson
([
'
database
'
=>
true
,
'
cache
'
=>
true
,
'
session
'
=>
true
,
]);
}
public
function
test_returns_500_status_and_false_on_db_error
()
{
DB
::
shouldReceive
(
'
table
'
)->
andThrow
(
new
Exception
());
$
resp
=
$
this
->
get
(
'
/status
'
);
$
resp
->
assertStatus
(
500
);
$
resp
->
assertJson
([
'
database
'
=>
false
,
]);
}
public
function
test_returns_500_status_and_false_on_wrong_cache_return
()
{
$
mockStore
= Mockery::
mock
(
new
ArrayStore
())->
makePartial
();
Cache::
swap
(
$
mockStore
);
$
mockStore
->
shouldReceive
(
'
get
'
)->
andReturn
(
'
cat
'
);
$
resp
=
$
this
->
get
(
'
/status
'
);
$
resp
->
assertStatus
(
500
);
$
resp
->
assertJson
([
'
cache
'
=>
false
,
]);
}
public
function
test_returns_500_status_and_false_on_wrong_session_return
()
{
$
session
= Session::
getFacadeRoot
();
$
mockSession
= Mockery::
mock
(
$
session
)->
makePartial
();
Session::
swap
(
$
mockSession
);
$
mockSession
->
shouldReceive
(
'
get
'
)->
andReturn
(
'
cat
'
);
$
resp
=
$
this
->
get
(
'
/status
'
);
$
resp
->
assertStatus
(
500
);
$
resp
->
assertJson
([
'
session
'
=>
false
,
]);
}
}
Back
|
FazBrowse Home
|
New Git URL