4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\EventDispatcher\Tests
;
14 use Symfony\Component\EventDispatcher\Event
;
15 use Symfony\Component\EventDispatcher\EventDispatcher
;
18 * Test class for Event.
20 class EventTest
extends \PHPUnit_Framework_TestCase
23 * @var \Symfony\Component\EventDispatcher\Event
28 * @var \Symfony\Component\EventDispatcher\EventDispatcher
30 protected $dispatcher;
33 * Sets up the fixture, for example, opens a network connection.
34 * This method is called before a test is executed.
36 protected function setUp()
38 $this->event
= new Event
;
39 $this->dispatcher
= new EventDispatcher();
43 * Tears down the fixture, for example, closes a network connection.
44 * This method is called after a test is executed.
46 protected function tearDown()
49 $this->eventDispatcher
= null;
52 public function testIsPropagationStopped()
54 $this->assertFalse($this->event
->isPropagationStopped());
57 public function testStopPropagationAndIsPropagationStopped()
59 $this->event
->stopPropagation();
60 $this->assertTrue($this->event
->isPropagationStopped());
63 public function testSetDispatcher()
65 $this->event
->setDispatcher($this->dispatcher
);
66 $this->assertSame($this->dispatcher
, $this->event
->getDispatcher());
69 public function testGetDispatcher()
71 $this->assertNull($this->event
->getDispatcher());
74 public function testGetName()
76 $this->assertNull($this->event
->getName());
79 public function testSetName()
81 $this->event
->setName('foo');
82 $this->assertEquals('foo', $this->event
->getName());