-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Added multiple environments support.
- Loading branch information
Showing
8 changed files
with
65 additions
and
15 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
vendor/ | ||
!vendor/.gitkeep | ||
.idea/ | ||
|
||
composer.phar | ||
composer.lock |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -13,20 +13,46 @@ | |
*/ | ||
class ExceptionListenerTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
/** | ||
* @covers \Kunstmaan\SentryBundle\EventListener\ExceptionListener | ||
*/ | ||
public function testExceptionListener() | ||
|
||
private function getListnerResult($environments, $currentEnv = 'test') | ||
{ | ||
$kernel = new \TestKernel('test', false); | ||
$kernel = new \TestKernel($currentEnv , false); | ||
$raven = new Raven('http://public:[email protected]/1', $kernel->getEnvironment()); | ||
$listener = new ExceptionListener($raven); | ||
$listener = new ExceptionListener($raven, $environments); | ||
$request = new Request(); | ||
$event = new GetResponseForExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new Exception("Test")); | ||
$result = $listener->onKernelException($event); | ||
return $result = $listener->onKernelException($event); | ||
} | ||
|
||
/** | ||
* @dataProvider unhandledEnvironmentsProvider | ||
* @covers \Kunstmaan\SentryBundle\EventListener\ExceptionListener | ||
*/ | ||
public function testExceptionListenerWithUnhandledEnv($environments) | ||
{ | ||
$result = $this->getListnerResult($environments, 'test'); | ||
$this->assertTrue($result[0] instanceof Exception); | ||
$this->assertEmpty($result[1]); | ||
$this->assertEquals($result[2], 'test'); | ||
} | ||
|
||
/** | ||
* @dataProvider unhandledEnvironmentsProvider | ||
* @covers \Kunstmaan\SentryBundle\EventListener\ExceptionListener | ||
*/ | ||
public function testExceptionListenerWithHandledEnv($environments) | ||
{ | ||
ini_set('error_log','/dev/null'); | ||
$result = $this->getListnerResult($environments, 'prod'); | ||
$this->assertTrue($result); | ||
} | ||
|
||
public static function unhandledEnvironmentsProvider() | ||
{ | ||
return array( | ||
array(array('prod', 'dev')), | ||
array(array('prod', 'dev', 'stage')), | ||
array(array('prod', 'dev', 'my_env')) | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters