BasicsTest.php 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354
  1. <?php
  2. declare(strict_types=1);
  3. /**
  4. * BasicsTest file
  5. *
  6. * CakePHP(tm) : Rapid Development Framework (https://cakephp.org)
  7. * Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  8. *
  9. * Licensed under The MIT License
  10. * For full copyright and license information, please see the LICENSE.txt
  11. * Redistributions of files must retain the above copyright notice
  12. *
  13. * @copyright Copyright (c) Cake Software Foundation, Inc. (https://cakefoundation.org)
  14. * @link https://cakephp.org CakePHP(tm) Project
  15. * @since 1.2.0
  16. * @license https://opensource.org/licenses/mit-license.php MIT License
  17. */
  18. namespace Cake\Test\TestCase;
  19. use Cake\Event\EventManager;
  20. use Cake\TestSuite\TestCase;
  21. /**
  22. * BasicsTest class
  23. */
  24. class BasicsTest extends TestCase
  25. {
  26. /**
  27. * Test that works in tandem with testEventManagerReset2 to
  28. * test the EventManager reset.
  29. *
  30. * The return value is passed to testEventManagerReset2 as
  31. * an arguments.
  32. */
  33. public function testEventManagerReset1(): EventManager
  34. {
  35. $eventManager = EventManager::instance();
  36. $this->assertInstanceOf(EventManager::class, $eventManager);
  37. return $eventManager;
  38. }
  39. /**
  40. * Test if the EventManager is reset between tests.
  41. *
  42. * @depends testEventManagerReset1
  43. */
  44. public function testEventManagerReset2(EventManager $prevEventManager): void
  45. {
  46. $this->assertInstanceOf(EventManager::class, $prevEventManager);
  47. $this->assertNotSame($prevEventManager, EventManager::instance());
  48. }
  49. }