forked from Kunstmaan/KunstmaanBundlesCMS
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix broken console exception tests (Kunstmaan#2080)
- Loading branch information
1 parent
205d70f
commit e21649a
Showing
3 changed files
with
50 additions
and
8 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
36 changes: 36 additions & 0 deletions
36
src/Kunstmaan/AdminBundle/Tests/EventListener/ConsoleExceptionSubscriberTest.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,36 @@ | ||
<?php | ||
|
||
namespace Kunstmaan\AdminBundle\Tests\EventListener; | ||
|
||
use Exception; | ||
use Codeception\Test\Unit; | ||
use Kunstmaan\AdminBundle\Command\ApplyAclCommand; | ||
use Kunstmaan\AdminBundle\EventListener\ConsoleExceptionSubscriber; | ||
use Psr\Log\LoggerInterface; | ||
use Symfony\Component\Console\Event\ConsoleErrorEvent; | ||
use Symfony\Component\Console\Input\InputInterface; | ||
use Symfony\Component\Console\Output\OutputInterface; | ||
|
||
class ConsoleExceptionSubscriberTest extends Unit | ||
{ | ||
public function testListener() | ||
{ | ||
if (!class_exists(ConsoleErrorEvent::class)) { | ||
// Nothing to test | ||
return; | ||
} | ||
|
||
$logger = $this->createMock(LoggerInterface::class); | ||
$logger->expects($this->once())->method('error')->willReturn(true); | ||
$subscriber = new ConsoleExceptionSubscriber($logger); | ||
|
||
$command = new ApplyAclCommand(); | ||
$exception = new Exception(); | ||
|
||
$input = $this->createMock(InputInterface::class); | ||
$output = $this->createMock(OutputInterface::class); | ||
$event = new ConsoleErrorEvent($input, $output, $exception, $command); | ||
|
||
$subscriber->onConsoleError($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