-
Notifications
You must be signed in to change notification settings - Fork 104
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #239 from jderusse/fix-compatibility
Fix compatibility issue with symfony 5.0
- Loading branch information
Showing
16 changed files
with
167 additions
and
47 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
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 |
---|---|---|
@@ -0,0 +1,60 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of Ekino New Relic bundle. | ||
* | ||
* (c) Ekino - Thomas Rabaix <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Ekino\NewRelicBundle\Tests\Listener; | ||
|
||
use Ekino\NewRelicBundle\Listener\ExceptionListener; | ||
use Ekino\NewRelicBundle\NewRelic\NewRelicInteractorInterface; | ||
use PHPUnit\Framework\TestCase; | ||
use Symfony\Component\HttpFoundation\Request; | ||
use Symfony\Component\HttpKernel\Event\ExceptionEvent; | ||
use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; | ||
use Symfony\Component\HttpKernel\Exception\BadRequestHttpException; | ||
use Symfony\Component\HttpKernel\HttpKernelInterface; | ||
|
||
class ExceptionListenerTest extends TestCase | ||
{ | ||
public function testOnKernelException() | ||
{ | ||
$exception = new \Exception('Boom'); | ||
|
||
$interactor = $this->getMockBuilder(NewRelicInteractorInterface::class)->getMock(); | ||
$interactor->expects($this->once())->method('noticeThrowable')->with($exception); | ||
|
||
$kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock(); | ||
$request = new Request(); | ||
|
||
$eventClass = \class_exists(ExceptionEvent::class) ? ExceptionEvent::class : GetResponseForExceptionEvent::class; | ||
$event = new $eventClass($kernel, $request, HttpKernelInterface::SUB_REQUEST, $exception); | ||
|
||
$listener = new ExceptionListener($interactor); | ||
$listener->onKernelException($event); | ||
} | ||
|
||
public function testOnKernelExceptionWithHttp() | ||
{ | ||
$exception = new BadRequestHttpException('Boom'); | ||
|
||
$interactor = $this->getMockBuilder(NewRelicInteractorInterface::class)->getMock(); | ||
$interactor->expects($this->never())->method('noticeThrowable'); | ||
|
||
$kernel = $this->getMockBuilder(HttpKernelInterface::class)->getMock(); | ||
$request = new Request(); | ||
|
||
$eventClass = \class_exists(ExceptionEvent::class) ? ExceptionEvent::class : GetResponseForExceptionEvent::class; | ||
$event = new $eventClass($kernel, $request, HttpKernelInterface::SUB_REQUEST, $exception); | ||
|
||
$listener = new ExceptionListener($interactor); | ||
$listener->onKernelException($event); | ||
} | ||
} |
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
Oops, something went wrong.