forked from magento/magento2
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Category collection now use getStoreId and not directly the store man…
…ager
- Loading branch information
1 parent
f6a0a90
commit 29431e9
Showing
2 changed files
with
41 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...code/Magento/Catalog/Test/Unit/Model/ResourceModel/Category/Collection/UrlRewriteTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
|
||
namespace Magento\Catalog\Test\Unit\Model\ResourceModel\Category\Collection; | ||
|
||
class UrlRewriteTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var \PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
protected $_model; | ||
|
||
protected function setUp() | ||
{ | ||
$this->_model = $this->getMockBuilder( | ||
\Magento\Catalog\Model\ResourceModel\Category\Collection::class | ||
)->disableOriginalConstructor() | ||
->setMethodsExcept(['joinUrlRewrite', 'setStoreId', 'getStoreId']) | ||
->getMock(); | ||
} | ||
|
||
|
||
public function testStoreIdUsedByUrlRewrite() | ||
{ | ||
$this->_model->expects($this->once()) | ||
->method('joinTable') | ||
->with( | ||
$this->anything(), | ||
$this->anything(), | ||
$this->anything(), | ||
$this->equalTo('{{table}}.is_autogenerated = 1 AND {{table}}.store_id = 100 AND {{table}}.entity_type = \'category\''), | ||
$this->anything() | ||
); | ||
$this->_model->setStoreId(100); | ||
$this->_model->joinUrlRewrite(); | ||
} | ||
} |