Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ConfigTest.php
Go to the documentation of this file.
1 <?php
8 
9 use \Magento\Framework\Event\Config;
10 
12 
18 class ConfigTest extends \PHPUnit\Framework\TestCase
19 {
23  protected $dataContainerMock;
24 
28  protected $config;
29 
30  protected function setUp()
31  {
32  $this->dataContainerMock = $this->createPartialMock(\Magento\Framework\Event\Config\Data::class, ['get']);
33  $this->config = new Config($this->dataContainerMock);
34  }
35 
36  public function testGetObservers()
37  {
38  $eventName = 'some_event';
39  $observers = ['observer1', 'observer3'];
40  $this->dataContainerMock->expects($this->once())
41  ->method('get')
42  ->with($eventName, $this->equalTo([]))
43  ->will($this->returnValue($observers));
44 
45  $result = $this->config->getObservers($eventName);
46  $this->assertEquals($observers, $result);
47  }
48 }