-
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.
updating configuration to include enabled flag and dsn
- Loading branch information
1 parent
6ffd700
commit bc97d46
Showing
6 changed files
with
21 additions
and
30 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
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 |
---|---|---|
|
@@ -14,45 +14,34 @@ | |
class ExceptionListenerTest extends \PHPUnit_Framework_TestCase | ||
{ | ||
|
||
private function getListnerResult($environments, $currentEnv = 'test') | ||
private function getListnerResult($enabled, $currentEnv = 'test') | ||
{ | ||
$kernel = new \TestKernel($currentEnv , false); | ||
$raven = new Raven('http://public:[email protected]/1', $kernel->getEnvironment()); | ||
$listener = new ExceptionListener($raven, $environments); | ||
$listener = new ExceptionListener($raven, $enabled); | ||
$request = new Request(); | ||
$event = new GetResponseForExceptionEvent($kernel, $request, HttpKernelInterface::MASTER_REQUEST, new Exception("Test")); | ||
return $result = $listener->onKernelException($event); | ||
} | ||
|
||
/** | ||
* @dataProvider unhandledEnvironmentsProvider | ||
* @covers \Kunstmaan\SentryBundle\EventListener\ExceptionListener | ||
*/ | ||
public function testExceptionListenerWithUnhandledEnv($environments) | ||
public function testExceptionListenerWithUnhandledEnv() | ||
{ | ||
$result = $this->getListnerResult($environments, 'test'); | ||
$result = $this->getListnerResult(false, '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) | ||
public function testExceptionListenerWithHandledEnv() | ||
{ | ||
ini_set('error_log','/dev/null'); | ||
$result = $this->getListnerResult($environments, 'prod'); | ||
$result = $this->getListnerResult(true, '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')) | ||
); | ||
} | ||
} |