Magento 2 Documentation  2.3
Documentation for Magento 2 CMS v2.3 (December 2018)
ScopeTest.php
Go to the documentation of this file.
1 <?php
8 
9 use \Magento\Framework\Config\Scope;
10 
11 class ScopeTest extends \PHPUnit\Framework\TestCase
12 {
16  protected $model;
17 
21  protected $areaListMock;
22 
23  protected function setUp()
24  {
25  $this->areaListMock = $this->createPartialMock(\Magento\Framework\App\AreaList::class, ['getCodes']);
26  $this->model = new Scope($this->areaListMock);
27  }
28 
29  public function testScopeSetGet()
30  {
31  $scopeName = 'test_scope';
32  $this->model->setCurrentScope($scopeName);
33  $this->assertEquals($scopeName, $this->model->getCurrentScope());
34  }
35 
36  public function testGetAllScopes()
37  {
38  $expectedBalances = ['primary', 'test_scope'];
39  $this->areaListMock->expects($this->once())
40  ->method('getCodes')
41  ->will($this->returnValue(['test_scope']));
42  $this->assertEquals($expectedBalances, $this->model->getAllScopes());
43  }
44 }