Skip to content

Commit b89be2d

Browse files
committed
B2B-2221: Magento\CatalogGraphQl\Plugin\DesignLoader plugin loads too much data
- Added unit test more related changes
1 parent 23230e8 commit b89be2d

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

lib/internal/Magento/Framework/View/Test/Unit/DesignLoaderTest.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@
1111
use Magento\Framework\App\AreaList;
1212
use Magento\Framework\App\Request\Http;
1313
use Magento\Framework\App\State;
14+
use Magento\Framework\View\DesignLoader;
1415
use PHPUnit\Framework\MockObject\MockObject;
1516
use PHPUnit\Framework\TestCase;
1617

1718
class DesignLoaderTest extends TestCase
1819
{
20+
/**
21+
* @var DesignLoader
22+
*/
23+
protected $_model;
24+
1925
/**
2026
* @var MockObject
2127
*/
@@ -39,6 +45,11 @@ protected function setUp(): void
3945
$this->_areaListMock = $this->createMock(AreaList::class);
4046
$this->_requestMock = $this->createMock(Http::class);
4147
$this->appState = $this->createMock(State::class);
48+
$this->_model = new DesignLoader(
49+
$this->_requestMock,
50+
$this->_areaListMock,
51+
$this->appState
52+
);
4253
}
4354

4455
/**
@@ -51,7 +62,8 @@ public function testLoad(): void
5162
$this->_areaListMock->expects($this->once())->method('getArea')->with('area')->willReturn($area);
5263
$area
5364
->method('load')
54-
->withConsecutive([Area::PART_DESIGN])
55-
->willReturnOnConsecutiveCalls($area);
65+
->withConsecutive([Area::PART_DESIGN], [Area::PART_TRANSLATE])
66+
->willReturnOnConsecutiveCalls($area, $area);
67+
$this->_model->load($this->_requestMock);
5668
}
5769
}

0 commit comments

Comments
 (0)