Skip to content

Instantly share code, notes, and snippets.

@znerol
Created October 4, 2014 14:13
Show Gist options
  • Save znerol/c2f044f3f15f1f7e3f1d to your computer and use it in GitHub Desktop.
Save znerol/c2f044f3f15f1f7e3f1d to your computer and use it in GitHub Desktop.
diff --git a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
index 2bd0750..3a1385c 100644
--- a/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
+++ b/src/Symfony/Component/EventDispatcher/Tests/AbstractEventDispatcherTest.php
@@ -12,10 +12,9 @@
namespace Symfony\Component\EventDispatcher\Tests;
use Symfony\Component\EventDispatcher\Event;
-use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\EventDispatcher\EventSubscriberInterface;
-class EventDispatcherTest extends \PHPUnit_Framework_TestCase
+abstract class AbstractEventDispatcherTest extends \PHPUnit_Framework_TestCase
{
/* Some pseudo events */
const preFoo = 'pre.foo';
@@ -32,7 +31,7 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase
protected function setUp()
{
- $this->dispatcher = new EventDispatcher();
+ $this->dispatcher = $this->createEventDispatcher();
$this->listener = new TestEventListener();
}
@@ -42,6 +41,8 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase
$this->listener = null;
}
+ abstract protected function createEventDispatcher();
+
public function testInitialState()
{
$this->assertEquals(array(), $this->dispatcher->getListeners());
@@ -269,7 +270,7 @@ class EventDispatcherTest extends \PHPUnit_Framework_TestCase
*/
public function testWorkaroundForPhpBug62976()
{
- $dispatcher = new EventDispatcher();
+ $dispatcher = $this->createEventDispatcher();
$dispatcher->addListener('bug.62976', new CallableClass());
$dispatcher->removeListener('bug.62976', function () {});
$this->assertTrue($dispatcher->hasListeners('bug.62976'));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment