-
Notifications
You must be signed in to change notification settings - Fork 9.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2637 from magento-borg/MAGETWO-45950-product-join…
…-query [borg] MAGETWO-45950: Product ResourceCollection wrong Join Query
- Loading branch information
Showing
3 changed files
with
52 additions
and
13 deletions.
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
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
51 changes: 51 additions & 0 deletions
51
dev/tests/integration/testsuite/Magento/Catalog/Model/ProductRepositoryTest.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,51 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\Catalog\Model; | ||
|
||
class ProductRepositoryTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var \Magento\Catalog\Api\ProductRepositoryInterface | ||
*/ | ||
private $productRepository; | ||
|
||
/** | ||
* @var \Magento\Framework\Api\SearchCriteriaBuilder | ||
*/ | ||
private $searchCriteriaBuilder; | ||
|
||
/** | ||
* Sets up common objects | ||
*/ | ||
protected function setUp() | ||
{ | ||
$this->productRepository = \Magento\Framework\App\ObjectManager::getInstance()->create( | ||
\Magento\Catalog\Api\ProductRepositoryInterface::class | ||
); | ||
|
||
$this->searchCriteriaBuilder = \Magento\Framework\App\ObjectManager::getInstance()->create( | ||
\Magento\Framework\Api\SearchCriteriaBuilder::class | ||
); | ||
} | ||
|
||
/** | ||
* Checks filtering by store_id | ||
* | ||
* @magentoDataFixture Magento/Catalog/Model/ResourceModel/_files/product_simple.php | ||
*/ | ||
public function testFilterByStoreId() | ||
{ | ||
$searchCriteria = $this->searchCriteriaBuilder | ||
->addFilter('store_id', '1', 'eq') | ||
->create(); | ||
$list = $this->productRepository->getList($searchCriteria); | ||
$count = $list->getTotalCount(); | ||
|
||
$this->assertGreaterThanOrEqual(1, $count); | ||
} | ||
} |