1: <?php
2:
3: 4: 5: 6: 7: 8: 9: 10:
11:
12: namespace Symfony\Component\EventDispatcher\Tests;
13:
14: use Symfony\Component\EventDispatcher\Event;
15: use Symfony\Component\EventDispatcher\EventDispatcher;
16:
17: 18: 19:
20: class EventTest extends \PHPUnit_Framework_TestCase
21: {
22: 23: 24:
25: protected $event;
26:
27: 28: 29:
30: protected $dispatcher;
31:
32: 33: 34: 35:
36: protected function setUp()
37: {
38: $this->event = new Event();
39: $this->dispatcher = new EventDispatcher();
40: }
41:
42: 43: 44: 45:
46: protected function tearDown()
47: {
48: $this->event = null;
49: $this->dispatcher = null;
50: }
51:
52: public function testIsPropagationStopped()
53: {
54: $this->assertFalse($this->event->isPropagationStopped());
55: }
56:
57: public function testStopPropagationAndIsPropagationStopped()
58: {
59: $this->event->stopPropagation();
60: $this->assertTrue($this->event->isPropagationStopped());
61: }
62:
63: public function testLegacySetDispatcher()
64: {
65: $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
66: $this->event->setDispatcher($this->dispatcher);
67: $this->assertSame($this->dispatcher, $this->event->getDispatcher());
68: }
69:
70: public function testLegacyGetDispatcher()
71: {
72: $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
73: $this->assertNull($this->event->getDispatcher());
74: }
75:
76: public function testLegacyGetName()
77: {
78: $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
79: $this->assertNull($this->event->getName());
80: }
81:
82: public function testLegacySetName()
83: {
84: $this->iniSet('error_reporting', -1 & ~E_USER_DEPRECATED);
85: $this->event->setName('foo');
86: $this->assertEquals('foo', $this->event->getName());
87: }
88: }
89: