FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
split-bootstack/tests/DebugViewTest.php at development · ZedsDev/split-bootstack · GitHub
ZedsDev
/
split-bootstack
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
split-bootstack
/
tests
/
DebugViewTest.php
Copy path
More file actions
More file actions
Latest commit
History
History
History
54 lines (46 loc) · 2.21 KB
Breadcrumbs
split-bootstack
/
tests
/
DebugViewTest.php
Copy path
File metadata and controls
54 lines (46 loc) · 2.21 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
<?php
namespace
Tests
;
use
BookStack
\
Auth
\
Access
\
SocialAuthService
;
use
Illuminate
\
Testing
\
TestResponse
;
class
DebugViewTest
extends
TestCase
{
public
function
test_debug_view_shows_expected_details
()
{
config
()->
set
(
'
app.debug
'
,
true
);
$
resp
=
$
this
->
getDebugViewForException
(
new
\
InvalidArgumentException
(
'
An error occurred during testing
'
));
// Error message
$
resp
->
assertSeeText
(
'
An error occurred during testing
'
);
// Exception Class
$
resp
->
assertSeeText
(
'
InvalidArgumentException
'
);
// Stack trace
$
resp
->
assertSeeText
(
'
#0
'
);
$
resp
->
assertSeeText
(
'
#1
'
);
// Warning message
$
resp
->
assertSeeText
(
'
WARNING: Application is in debug mode. This mode has the potential to leak
'
);
// PHP version
$
resp
->
assertSeeText
(
'
PHP Version:
'
.
phpversion
());
// BookStack version
$
resp
->
assertSeeText
(
'
BookStack Version:
'
.
trim
(
file_get_contents
(
base_path
(
'
version
'
))));
// Dynamic help links
$
this
->
withHtml
(
$
resp
)->
assertElementExists
(
'
a[href*="q=
'
.
urlencode
(
'
BookStack An error occurred during testing
'
) .
'
"]
'
);
$
this
->
withHtml
(
$
resp
)->
assertElementExists
(
'
a[href*="?q=is%3Aissue+
'
.
urlencode
(
'
An error occurred during testing
'
) .
'
"]
'
);
}
public
function
test_debug_view_only_shows_when_debug_mode_is_enabled
()
{
config
()->
set
(
'
app.debug
'
,
true
);
$
resp
=
$
this
->
getDebugViewForException
(
new
\
InvalidArgumentException
(
'
An error occurred during testing
'
));
$
resp
->
assertSeeText
(
'
Stack Trace
'
);
$
resp
->
assertDontSeeText
(
'
An unknown error occurred
'
);
config
()->
set
(
'
app.debug
'
,
false
);
$
resp
=
$
this
->
getDebugViewForException
(
new
\
InvalidArgumentException
(
'
An error occurred during testing
'
));
$
resp
->
assertDontSeeText
(
'
Stack Trace
'
);
$
resp
->
assertSeeText
(
'
An unknown error occurred
'
);
}
protected
function
getDebugViewForException
(
\
Exception
$
exception
):
TestResponse
{
// Fake an error via social auth service used on login page
$
mockService
=
$
this
->
mock
(SocialAuthService::class);
$
mockService
->
shouldReceive
(
'
getActiveDrivers
'
)->
andThrow
(
$
exception
);
return
$
this
->
get
(
'
/login
'
);
}
}
Back
|
FazBrowse Home
|
New Git URL