ConfigTest.php 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. <?php
  2. /**
  3. * Copyright © Magento, Inc. All rights reserved.
  4. * See COPYING.txt for license details.
  5. */
  6. namespace Magento\Framework\Event\Test\Unit;
  7. use \Magento\Framework\Event\Config;
  8. use Magento\Framework\Event\Config\Data;
  9. /**
  10. * Class ConfigTest
  11. *
  12. * @package Magento\Framework\Event
  13. */
  14. class ConfigTest extends \PHPUnit\Framework\TestCase
  15. {
  16. /**
  17. * @var Data|\PHPUnit_Framework_MockObject_MockObject
  18. */
  19. protected $dataContainerMock;
  20. /**
  21. * @var Config
  22. */
  23. protected $config;
  24. protected function setUp()
  25. {
  26. $this->dataContainerMock = $this->createPartialMock(\Magento\Framework\Event\Config\Data::class, ['get']);
  27. $this->config = new Config($this->dataContainerMock);
  28. }
  29. public function testGetObservers()
  30. {
  31. $eventName = 'some_event';
  32. $observers = ['observer1', 'observer3'];
  33. $this->dataContainerMock->expects($this->once())
  34. ->method('get')
  35. ->with($eventName, $this->equalTo([]))
  36. ->will($this->returnValue($observers));
  37. $result = $this->config->getObservers($eventName);
  38. $this->assertEquals($observers, $result);
  39. }
  40. }