菜谱项目

EventTest.php 1.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  1. <?php
  2. /*
  3. * This file is part of the Symfony package.
  4. *
  5. * (c) Fabien Potencier <fabien@symfony.com>
  6. *
  7. * For the full copyright and license information, please view the LICENSE
  8. * file that was distributed with this source code.
  9. */
  10. namespace Symfony\Component\EventDispatcher\Tests;
  11. use PHPUnit\Framework\TestCase;
  12. use Symfony\Component\EventDispatcher\Event;
  13. /**
  14. * Test class for Event.
  15. */
  16. class EventTest extends TestCase
  17. {
  18. /**
  19. * @var \Symfony\Component\EventDispatcher\Event
  20. */
  21. protected $event;
  22. /**
  23. * Sets up the fixture, for example, opens a network connection.
  24. * This method is called before a test is executed.
  25. */
  26. protected function setUp()
  27. {
  28. $this->event = new Event();
  29. }
  30. /**
  31. * Tears down the fixture, for example, closes a network connection.
  32. * This method is called after a test is executed.
  33. */
  34. protected function tearDown()
  35. {
  36. $this->event = null;
  37. }
  38. public function testIsPropagationStopped()
  39. {
  40. $this->assertFalse($this->event->isPropagationStopped());
  41. }
  42. public function testStopPropagationAndIsPropagationStopped()
  43. {
  44. $this->event->stopPropagation();
  45. $this->assertTrue($this->event->isPropagationStopped());
  46. }
  47. }