Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Forwardport] magento/magento2#4389 Widget cache error #14816

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@ public function getCacheKeyInfo()
intval($this->getRequest()->getParam($this->getData('page_var_name'), 1)),
$this->getProductsPerPage(),
$conditions,
$this->json->serialize($this->getRequest()->getParams())
$this->json->serialize($this->getRequest()->getParams()),
$this->getTemplate(),
$this->getTitle()
];
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,8 +87,8 @@ protected function setUp()
{
$this->collectionFactory =
$this->getMockBuilder(\Magento\Catalog\Model\ResourceModel\Product\CollectionFactory::class)
->setMethods(['create'])
->disableOriginalConstructor()->getMock();
->setMethods(['create'])
->disableOriginalConstructor()->getMock();
$this->visibility = $this->getMockBuilder(\Magento\Catalog\Model\Product\Visibility::class)
->setMethods(['getVisibleInCatalogIds'])
->disableOriginalConstructor()
Expand Down Expand Up @@ -144,6 +144,8 @@ public function testGetCacheKeyInfo()
$this->productsList->setData('conditions', 'some_serialized_conditions');

$this->productsList->setData('page_var_name', 'page_number');
$this->productsList->setTemplate('test_template');
$this->productsList->setData('title', 'test_title');
$this->request->expects($this->once())->method('getParam')->with('page_number')->willReturn(1);

$this->request->expects($this->once())->method('getParams')->willReturn('request_params');
Expand All @@ -166,7 +168,9 @@ public function testGetCacheKeyInfo()
1,
5,
'some_serialized_conditions',
json_encode('request_params')
json_encode('request_params'),
'test_template',
'test_title'
];
$this->assertEquals($cacheKey, $this->productsList->getCacheKeyInfo());
}
Expand Down Expand Up @@ -251,9 +255,10 @@ public function testGetPagerHtml()
* Test public `createCollection` method and protected `getPageSize` method via `createCollection`
*
* @param bool $pagerEnable
* @param int $productsCount
* @param int $productsPerPage
* @param int $expectedPageSize
* @param int $productsCount
* @param int $productsPerPage
* @param int $expectedPageSize
*
* @dataProvider createCollectionDataProvider
*/
public function testCreateCollection($pagerEnable, $productsCount, $productsPerPage, $expectedPageSize)
Expand Down Expand Up @@ -382,6 +387,7 @@ public function testGetIdentities()

/**
* @param $collection
*
* @return \PHPUnit_Framework_MockObject_MockObject
*/
private function getConditionsForCollection($collection)
Expand Down