public function testAddProductNameFilter() { $collection = $this->collection->addProductNameFilter('TestProductName'); $sql = $collection->getSelect()->__toString(); $sql = trim(preg_replace('/\\s+/', ' ', $sql)); $this->assertEquals(trim(preg_replace('/\\s+/', ' ', $this->sql)), $sql); }
public function testAddProductNameFilter() { $entityMetadata = $this->getMockBuilder('Magento\\Framework\\EntityManager\\EntityMetadata')->disableOriginalConstructor()->getMock(); $entityMetadata->expects($this->once())->method('getLinkField')->willReturn('entity_id'); $this->metadataPool->expects($this->once())->method('getMetadata')->with(ProductInterface::class)->willReturn($entityMetadata); $collection = $this->collection->addProductNameFilter('TestProductName'); $sql = $collection->getSelect()->__toString(); $sql = trim(preg_replace('/\\s+/', ' ', $sql)); $this->assertEquals(trim(preg_replace('/\\s+/', ' ', $this->sql)), $sql); }