15 use Psr\Log\LoggerInterface;
54 private $connectionMock;
73 $this->entityFactoryMock = $this->createMock(EntityFactory::class);
74 $this->loggerMock = $this->createMock(LoggerInterface::class);
75 $this->fetchStrategyMock = $this->createMock(FetchStrategyInterface::class);
76 $this->resourceModelAbstractDb = $this->createMock(FetchStrategyInterface::class);
77 $this->connectionMock = $this->createPartialMock(Mysql::class, [
'select',
'getIndexList']);
78 $this->selectMock = $this->createPartialMock(Select::class, [
'getPart',
'where']);
80 $this->resourceModelAbstractDb = $this->getMockBuilder(ResourceModelAbstractDb::class)
81 ->disableOriginalConstructor()
82 ->getMockForAbstractClass();
84 $this->collectionAbstractDbMock = $this->getMockBuilder(CollectionAbstractDb::class)
85 ->setMethods([
'getConnection',
'getSelect',
'getMainTable'])
86 ->disableOriginalConstructor()
87 ->getMockForAbstractClass();
95 $filter->setValue(
'test');
97 $this->collectionAbstractDbMock->expects($this->any())
98 ->method(
'getMainTable')
99 ->willReturn(
'testTable');
101 $this->collectionAbstractDbMock->expects($this->once())
102 ->method(
'getConnection')
103 ->willReturn($this->connectionMock);
105 $this->connectionMock->expects($this->any())
107 ->willReturn($this->selectMock);
108 $this->connectionMock->expects($this->once())
109 ->method(
'getIndexList')
110 ->willReturn([[
'INDEX_TYPE' =>
'FULLTEXT',
'COLUMNS_LIST' => [
'col1',
'col2']]]);
112 $this->selectMock->expects($this->once())
115 $this->selectMock->expects($this->once())
119 $this->collectionAbstractDbMock->expects($this->exactly(2))
120 ->method(
'getSelect')
121 ->willReturn($this->selectMock);
123 $this->fulltextFilter->apply($this->collectionAbstractDbMock, $filter);
129 public function testApplyWrongCollectionType()
132 $mviewCollection = $this->getMockBuilder(MviewCollection::class)
134 ->disableOriginalConstructor()
137 $this->fulltextFilter->apply($mviewCollection,
new Filter());
$collectionAbstractDbMock