Yaffs site version 1.1
[yaffs-website] / vendor / symfony / event-dispatcher / Tests / EventTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\EventDispatcher\Tests;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\EventDispatcher\Event;
16 use Symfony\Component\EventDispatcher\EventDispatcher;
17
18 /**
19  * Test class for Event.
20  */
21 class EventTest extends TestCase
22 {
23     /**
24      * @var \Symfony\Component\EventDispatcher\Event
25      */
26     protected $event;
27
28     /**
29      * @var \Symfony\Component\EventDispatcher\EventDispatcher
30      */
31     protected $dispatcher;
32
33     /**
34      * Sets up the fixture, for example, opens a network connection.
35      * This method is called before a test is executed.
36      */
37     protected function setUp()
38     {
39         $this->event = new Event();
40         $this->dispatcher = new EventDispatcher();
41     }
42
43     /**
44      * Tears down the fixture, for example, closes a network connection.
45      * This method is called after a test is executed.
46      */
47     protected function tearDown()
48     {
49         $this->event = null;
50         $this->dispatcher = null;
51     }
52
53     public function testIsPropagationStopped()
54     {
55         $this->assertFalse($this->event->isPropagationStopped());
56     }
57
58     public function testStopPropagationAndIsPropagationStopped()
59     {
60         $this->event->stopPropagation();
61         $this->assertTrue($this->event->isPropagationStopped());
62     }
63
64     /**
65      * @group legacy
66      */
67     public function testLegacySetDispatcher()
68     {
69         $this->event->setDispatcher($this->dispatcher);
70         $this->assertSame($this->dispatcher, $this->event->getDispatcher());
71     }
72
73     /**
74      * @group legacy
75      */
76     public function testLegacyGetDispatcher()
77     {
78         $this->assertNull($this->event->getDispatcher());
79     }
80
81     /**
82      * @group legacy
83      */
84     public function testLegacyGetName()
85     {
86         $this->assertNull($this->event->getName());
87     }
88
89     /**
90      * @group legacy
91      */
92     public function testLegacySetName()
93     {
94         $this->event->setName('foo');
95         $this->assertEquals('foo', $this->event->getName());
96     }
97 }