Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ScopeResolverPoolTest.php
Go to the documentation of this file.
1 <?php
8 
9 class ScopeResolverPoolTest extends \PHPUnit\Framework\TestCase
10 {
14  protected $_helper;
15 
16  protected function setUp()
17  {
18  $this->_helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
19  }
20 
21  public function testGet()
22  {
23  $scope = $this->createMock(\Magento\Framework\App\ScopeResolverInterface::class);
24  $scopeResolver = $this->_helper->getObject(
25  \Magento\Framework\App\ScopeResolverPool::class,
26  [
27  'scopeResolvers' => ['test' => $scope]
28  ]
29  );
30  $this->assertSame($scope, $scopeResolver->get('test'));
31  }
32 
41  public function testGetException($scope)
42  {
43  $scopeResolver = $this->_helper->getObject(
44  \Magento\Framework\App\ScopeResolverPool::class,
45  [
46  'scopeResolvers' => ['test' => new \Magento\Framework\DataObject()]
47  ]
48  );
49  $scopeResolver->get($scope);
50  }
51 
55  public function testGetExceptionDataProvider()
56  {
57  return [
58  ['undefined'],
59  ['test'],
60  ];
61  }
62 }