-
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 #4911 from magento-mpi/MPI-PR-2019-10-18
MPI-PR-2019-10-18
- Loading branch information
Showing
19 changed files
with
327 additions
and
74 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
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
74 changes: 74 additions & 0 deletions
74
...nto/CatalogSearch/Test/Unit/Ui/DataProvider/Product/AddFulltextFilterToCollectionTest.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,74 @@ | ||
<?php | ||
/** | ||
* Copyright © Magento, Inc. All rights reserved. | ||
* See COPYING.txt for license details. | ||
*/ | ||
declare(strict_types=1); | ||
|
||
namespace Magento\CatalogSearch\Test\Unit\Ui\DataProvider\Product; | ||
|
||
use Magento\Framework\TestFramework\Unit\Helper\ObjectManager as ObjectManagerHelper; | ||
use Magento\CatalogSearch\Model\ResourceModel\Search\Collection as SearchCollection; | ||
use Magento\Framework\Data\Collection; | ||
use Magento\CatalogSearch\Ui\DataProvider\Product\AddFulltextFilterToCollection; | ||
|
||
class AddFulltextFilterToCollectionTest extends \PHPUnit\Framework\TestCase | ||
{ | ||
/** | ||
* @var SearchCollection|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $searchCollection; | ||
|
||
/** | ||
* @var Collection|\PHPUnit_Framework_MockObject_MockObject | ||
*/ | ||
private $collection; | ||
|
||
/** | ||
* @var ObjectManagerHelper | ||
*/ | ||
private $objectManager; | ||
|
||
/** | ||
* @var AddFulltextFilterToCollection | ||
*/ | ||
private $model; | ||
|
||
protected function setUp() | ||
{ | ||
$this->objectManager = new ObjectManagerHelper($this); | ||
|
||
$this->searchCollection = $this->getMockBuilder(SearchCollection::class) | ||
->setMethods(['addBackendSearchFilter', 'load', 'getAllIds']) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
$this->searchCollection->expects($this->any()) | ||
->method('load') | ||
->willReturnSelf(); | ||
$this->collection = $this->getMockBuilder(Collection::class) | ||
->setMethods(['addIdFilter']) | ||
->disableOriginalConstructor() | ||
->getMock(); | ||
|
||
$this->model = $this->objectManager->getObject( | ||
AddFulltextFilterToCollection::class, | ||
[ | ||
'searchCollection' => $this->searchCollection | ||
] | ||
); | ||
} | ||
|
||
public function testAddFilter() | ||
{ | ||
$this->searchCollection->expects($this->once()) | ||
->method('addBackendSearchFilter') | ||
->with('test'); | ||
$this->searchCollection->expects($this->once()) | ||
->method('getAllIds') | ||
->willReturn([]); | ||
$this->collection->expects($this->once()) | ||
->method('addIdFilter') | ||
->with(-1); | ||
$this->model->addFilter($this->collection, 'test', ['fulltext' => 'test']); | ||
} | ||
} |
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
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
Oops, something went wrong.