-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update repository requirements and some CS fixes from #26
- Loading branch information
Showing
9 changed files
with
149 additions
and
2,634 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,9 +1,21 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of ListenersDebugCommandBundle | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Egulias\ListenersDebugCommandBundle; | ||
|
||
use Symfony\Component\HttpKernel\Bundle\Bundle; | ||
|
||
/** | ||
* EguliasListenersDebugCommandBundle | ||
* | ||
* @author Eduardo Gulias <[email protected]> | ||
*/ | ||
class EguliasListenersDebugCommandBundle extends Bundle | ||
{ | ||
} |
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,14 +1,29 @@ | ||
<?php | ||
|
||
/** | ||
* This file is part of ListenersDebugCommandBundle | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
namespace Egulias\ListenersDebugCommandBundle\Test\Command; | ||
|
||
use Egulias\ListenersDebugCommandBundle\Command\ListenersCommand; | ||
use PHPUnit_Framework_TestCase; | ||
|
||
use Symfony\Bundle\FrameworkBundle\Console\Application; | ||
use Symfony\Component\Console\Tester\CommandTester; | ||
use Symfony\Component\DependencyInjection\Container; | ||
use Symfony\Component\DependencyInjection\ParameterBag\ParameterBag; | ||
|
||
class ListenersCommandTest extends \PHPUnit_Framework_TestCase | ||
use Egulias\ListenersDebugCommandBundle\Command\ListenersCommand; | ||
|
||
/** | ||
* ListenersCommand test | ||
* | ||
* @author Eduardo Gulias <[email protected]> | ||
*/ | ||
class ListenersCommandTest extends PHPUnit_Framework_TestCase | ||
{ | ||
protected $application; | ||
|
||
|
@@ -35,12 +50,41 @@ public function testBaseCommand() | |
$this->assertRegExp('/Class Name/', $display); | ||
} | ||
|
||
public function testEventNameFilter() | ||
public function testEventNameFilterForListener() | ||
{ | ||
$display = $this->executeCommand(array('name' => 'acme.demo.listener')); | ||
$display = $this->executeCommand(array('name' => 'dummy_listener')); | ||
|
||
$this->assertRegExp('/Class/', $display); | ||
$this->assertRegExp('/ControllerListener/', $display); | ||
$this->assertRegExp('/DummyListener/', $display); | ||
$this->assertRegExp('/Event/', $display); | ||
$this->assertRegExp('/Method/', $display); | ||
$this->assertRegExp('/Type/', $display); | ||
$this->assertRegExp('/Priority/', $display); | ||
$this->assertRegExp('/listener/', $display); | ||
$this->assertRegExp('/listen/', $display); | ||
$this->assertRegExp('/8/', $display); | ||
} | ||
|
||
public function testEventNameFilterForSubscriber() | ||
{ | ||
$display = $this->executeCommand(array('name' => 'dummy_listener_subscriber')); | ||
|
||
$this->assertRegExp('/Class/', $display); | ||
$this->assertRegExp('/DummySubscriber/', $display); | ||
$this->assertRegExp('/Event/', $display); | ||
$this->assertRegExp('/Method/', $display); | ||
$this->assertRegExp('/Priority/', $display); | ||
$this->assertRegExp('/Type/', $display); | ||
$this->assertRegExp('/subscriber/', $display); | ||
$this->assertRegExp('/listen/', $display); | ||
$this->assertRegExp('/8/', $display); | ||
} | ||
|
||
public function testEventNameFilterForAlias() | ||
{ | ||
$display = $this->executeCommand(array('name' => 'dummy_listener_subscriber_alias')); | ||
|
||
$this->assertRegExp('/alias for the service dummy_listener_subscriber/', $display); | ||
} | ||
|
||
public function testFilterByEventName() | ||
|
@@ -63,6 +107,19 @@ public function testShowOnlySubscribers() | |
|
||
$this->assertNotRegExp('/\|listener\|/', $display); | ||
} | ||
|
||
public function testShowPrivate() | ||
{ | ||
$display = $this->executeCommand(array('--show-private' => null)); | ||
|
||
$this->assertNotRegExp('/\|private\|/', $display); | ||
} | ||
|
||
public function testShowOnlyOneListener() | ||
{ | ||
|
||
} | ||
|
||
private function executeCommand(array $options) | ||
{ | ||
$command = $this->application->find('container:debug:listeners'); | ||
|
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,11 @@ | ||
<?php | ||
|
||
namespace Egulias\ListenersDebugCommandBundle\Tests; | ||
|
||
class DummyListener | ||
{ | ||
public function listen() | ||
{ | ||
|
||
} | ||
} |
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,22 @@ | ||
<?php | ||
|
||
namespace Egulias\ListenersDebugCommandBundle\Tests; | ||
|
||
use Symfony\Component\EventDispatcher\EventSubscriberInterface; | ||
|
||
class DummySubscriber implements EventSubscriberInterface | ||
{ | ||
public static function getSubscribedEvents() | ||
{ | ||
return array ( | ||
'kernel.terminate', | ||
'kernel.view' => array('listen', 8), | ||
'rare.condition' => array(array('listen', 8)) | ||
); | ||
} | ||
|
||
public function listen() | ||
{ | ||
|
||
} | ||
} |
Oops, something went wrong.