-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
remove code from isHandling, but dont throw exception on non handling (…
…#26) * remove code from isHandling, but dont throw exception on non handling * code standards
- Loading branch information
Harry Bragg
authored
Jun 17, 2018
1 parent
1d6c1f7
commit 26ec6b4
Showing
3 changed files
with
144 additions
and
123 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
62 changes: 62 additions & 0 deletions
62
tests/integration/src/Graze/Monolog/Handler/RaygunHandlerIntegrationTest.php
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 |
---|---|---|
@@ -0,0 +1,62 @@ | ||
<?php | ||
|
||
namespace Graze\Monolog\Handler; | ||
|
||
use Mockery; | ||
use Monolog\Logger; | ||
use PHPUnit\Framework\TestCase; | ||
use Raygun4php\RaygunClient; | ||
use RuntimeException; | ||
|
||
class RaygunHandlerIntegrationTest extends TestCase | ||
{ | ||
/** @var Logger */ | ||
private $logger; | ||
/** @var mixed */ | ||
private $raygun; | ||
/** @var RaygunHandler */ | ||
private $handler; | ||
|
||
public function setUp() | ||
{ | ||
$this->raygun = Mockery::mock(RaygunClient::class); | ||
$this->handler = new RaygunHandler($this->raygun, Logger::NOTICE); | ||
$this->logger = new Logger('raygunHandlerTest', [$this->handler]); | ||
} | ||
|
||
public function testErrorWithExceptionTriggersLogger() | ||
{ | ||
$exception = new RuntimeException('test exception'); | ||
|
||
$this->raygun | ||
->shouldReceive('SendException') | ||
->once() | ||
->with($exception, [], [], null); | ||
|
||
$this->logger->error('test error', ['exception' => $exception]); | ||
} | ||
|
||
public function testErrorWithErrorWillTriggerLogger() | ||
{ | ||
$this->raygun | ||
->shouldReceive('SendError') | ||
->once() | ||
->with(0, "test line error", __FILE__, 5, [], [], null); | ||
$this->logger->error('test line error', ['file' => __FILE__, 'line' => 5]); | ||
} | ||
|
||
public function testErrorWithNoLineWillDoNothing() | ||
{ | ||
$this->logger->error('test line error', ['file' => __FILE__]); | ||
} | ||
|
||
public function testErrorWithNoFileWillDoNothing() | ||
{ | ||
$this->logger->error('test line error', ['line' => __FILE__]); | ||
} | ||
|
||
public function testErrorWithNeitherWillDoNothing() | ||
{ | ||
$this->logger->error('test line error'); | ||
} | ||
} |
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