merged branch drak/patch-1 (PR #2784)
Commits -------541888d
[EventDispatcher] Added missing object destruction in test tearDown() and removed duplicated tests. Discussion ---------- [EventDispatcher] Merge two test cases into one. Bug fix: no Feature addition: no Backwards compatibility break: no Symfony2 tests pass: yes Fixes the following tickets: - Todo: - Ref667c24d73d (commitcomment-766966)
--------------------------------------------------------------------------- by stof at 2011/12/04 19:43:32 -0800 ``testGetName`` could also be removed as it is already tested by ``getSetName``, and same for the event dispatcher. Basically, you cannot test the setter without testing the associated getter so no need for 2 tests for them as it is forced to be duplicate for part of them (and no need to use so long names IMO) --------------------------------------------------------------------------- by drak at 2011/12/05 00:49:22 -0800 I've refactored the test to remove duplication, I pushed as a rebase so the new commit is541888d
referencing the same discussion.
This commit is contained in:
commit
839dd2aaa4
@ -23,7 +23,7 @@ class EventTest extends \PHPUnit_Framework_TestCase
|
||||
* @var \Symfony\Component\EventDispatcher\Event
|
||||
*/
|
||||
protected $event;
|
||||
|
||||
|
||||
/**
|
||||
* @var \Symfony\Component\EventDispatcher\EventDispatcher
|
||||
*/
|
||||
@ -47,18 +47,16 @@ class EventTest extends \PHPUnit_Framework_TestCase
|
||||
protected function tearDown()
|
||||
{
|
||||
$this->event = null;
|
||||
$this->eventDispatcher = null;
|
||||
}
|
||||
|
||||
public function testIsPropagationStopped()
|
||||
{
|
||||
$this->assertFalse($this->event->isPropagationStopped());
|
||||
$this->event->stopPropagation();
|
||||
$this->assertTrue($this->event->isPropagationStopped());
|
||||
}
|
||||
|
||||
public function testStopPropagation()
|
||||
public function testStopPropagationAndIsPropagationStopped()
|
||||
{
|
||||
$this->assertFalse($this->event->isPropagationStopped());
|
||||
$this->event->stopPropagation();
|
||||
$this->assertTrue($this->event->isPropagationStopped());
|
||||
}
|
||||
@ -72,8 +70,6 @@ class EventTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetDispatcher()
|
||||
{
|
||||
$this->assertNull($this->event->getDispatcher());
|
||||
$this->event->setDispatcher($this->dispatcher);
|
||||
$this->assertSame($this->dispatcher, $this->event->getDispatcher());
|
||||
}
|
||||
|
||||
public function testGetName()
|
||||
@ -83,7 +79,6 @@ class EventTest extends \PHPUnit_Framework_TestCase
|
||||
|
||||
public function testSetName()
|
||||
{
|
||||
$this->assertNull($this->event->getName());
|
||||
$this->event->setName('foo');
|
||||
$this->assertEquals('foo', $this->event->getName());
|
||||
}
|
||||
|
Reference in New Issue
Block a user