Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F8322082
HandlerTest.php
No One
Temporary
Actions
Download File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
HandlerTest.php
View Options
<?php
namespace
Nasqueron\Notifications\Tests\Exceptions
;
use
Illuminate\Auth\Access\AuthorizationException
;
use
Nasqueron\Notifications\Exceptions\Handler
;
use
Nasqueron\Notifications\Tests\TestCase
;
use
App
;
use
Config
;
use
Mockery
;
class
HandlerTest
extends
TestCase
{
/**
* Illuminate\Foundation\Exceptions\Handler
*/
private
$handler
;
/**
* Raven_Client
*/
private
$ravenClientMock
;
public
function
setUp
()
{
parent
::
setUp
();
$logger
=
App
::
make
(
'log'
);
$this
->
handler
=
new
Handler
(
$logger
);
$this
->
mockRavenClient
();
}
protected
function
mockRavenClient
()
{
// Inject into our container a mock of Raven_Client
$this
->
ravenClientMock
=
Mockery
::
mock
(
'Raven_Client'
);
$this
->
app
->
instance
(
'raven'
,
$this
->
ravenClientMock
);
// Environment shouldn't be 'testing' and DSN should be defined,
// so Handler::report will call Raven to report to Sentry
Config
::
set
(
'app.env'
,
'testing-raven'
);
Config
::
set
(
'services.sentry.dsn'
,
'mock'
);
}
public
function
testRavenReport
()
{
$this
->
ravenClientMock
->
shouldReceive
(
'captureException'
)->
once
();
$this
->
handler
->
report
(
new
\Exception
);
}
public
function
testExceptionInDontReportArray
()
{
$this
->
ravenClientMock
->
shouldReceive
(
'captureException'
)->
never
();
$this
->
handler
->
report
(
new
AuthorizationException
);
}
}
File Metadata
Details
Attached
Mime Type
text/x-php
Expires
Tue, May 13, 16:59 (13 h, 10 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2571364
Default Alt Text
HandlerTest.php (1 KB)
Attached To
Mode
rNOTIF Notifications center
Attached
Detach File
Event Timeline
Log In to Comment