EventManagerTraitTest.php 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. <?php
  2. /**
  3. * CakePHP(tm) : Rapid Development Framework (http://cakephp.org)
  4. * Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  5. *
  6. * Licensed under The MIT License
  7. * Redistributions of files must retain the above copyright notice.
  8. *
  9. * @copyright Copyright (c) Cake Software Foundation, Inc. (http://cakefoundation.org)
  10. * @link http://cakephp.org CakePHP(tm) Project
  11. * @since 3.0.0
  12. * @license http://www.opensource.org/licenses/mit-license.php MIT License
  13. */
  14. namespace Cake\Test\TestCase\Event;
  15. use Cake\Event\EventManager;
  16. use Cake\Event\EventManagerTrait;
  17. use Cake\TestSuite\TestCase;
  18. /**
  19. * EventManagerTrait test case
  20. *
  21. */
  22. class EventManagerTraitTest extends TestCase {
  23. /**
  24. * setup
  25. *
  26. * @return void
  27. */
  28. public function setUp() {
  29. parent::setUp();
  30. $this->subject = $this->getObjectForTrait('Cake\Event\EventManagerTrait');
  31. }
  32. /**
  33. * testIsInitiallyEmpty
  34. *
  35. * @return void
  36. */
  37. public function testIsInitiallyEmpty() {
  38. $this->assertAttributeEmpty('_eventManager', $this->subject);
  39. }
  40. /**
  41. * testSettingEventManager
  42. *
  43. * @covers EventManagerTrait::eventManager
  44. * @return void
  45. */
  46. public function testSettingEventManager() {
  47. $eventManager = new EventManager();
  48. $this->subject->eventManager($eventManager);
  49. $this->assertSame($eventManager, $this->subject->eventManager());
  50. }
  51. }