/**
  * Test that Magento\Eav\Model\Resource\Attribute\Collection::_initSelect sets expressions
  * that can be properly quoted by Zend_Db_Expr::quoteIdentifier
  *
  * @dataProvider initSelectDataProvider
  */
 public function testInitSelect($column, $value, $expected)
 {
     $helper = new \Magento\TestFramework\Helper\ObjectManager($this);
     $this->model = $helper->getObject('\\Magento\\Customer\\Model\\Resource\\Attribute\\Collection', array('entityFactory' => $this->entityFactoryMock, 'logger' => $this->loggerMock, 'fetchStrategy' => $this->fetchStrategyMock, 'eventManager' => $this->eventManagerMock, 'eavConfig' => $this->eavConfigMock, 'storeManager' => $this->storeManagerMock, 'connection' => $this->connectionMock, 'resource' => $this->resourceMock));
     $this->model->addFieldToFilter($column, $value);
     $this->assertEquals($expected, $this->model->getSelectCountSql()->assemble());
 }
Example #2
0
 /**
  * @dataProvider initSelectDataProvider
  */
 public function testInitSelect($column, $value)
 {
     $helper = new \Magento\Framework\TestFramework\Unit\Helper\ObjectManager($this);
     $this->model = $helper->getObject('Magento\\Customer\\Model\\ResourceModel\\Attribute\\Collection', ['entityFactory' => $this->entityFactoryMock, 'logger' => $this->loggerMock, 'fetchStrategy' => $this->fetchStrategyMock, 'eventManager' => $this->eventManagerMock, 'eavConfig' => $this->eavConfigMock, 'storeManager' => $this->storeManagerMock, 'connection' => $this->connectionMock, 'resource' => $this->resourceMock]);
     $this->model->addFieldToFilter($column, $value);
     $this->selectRenderer->expects($this->once())->method('render')->withAnyParameters();
     $this->model->getSelectCountSql()->assemble();
 }
 public function testAddFieldToFilter()
 {
     $this->_prepareAddFilterStubs();
     $this->abstractCollection->addFieldToFilter('website_ids', []);
 }
Example #4
-1
 public function testAddFieldToFilter()
 {
     $field = 'title';
     $value = 'test_filter';
     $searchSql = 'sql query';
     $this->collection->expects($this->once())->method('_translateCondition')->with($field, $value)->will($this->returnValue($searchSql));
     $this->select->expects($this->once())->method('where')->with($this->equalTo($searchSql), $this->equalTo(null), $this->equalTo(\Magento\Framework\DB\Select::TYPE_CONDITION));
     $this->collection->addFieldToFilter($field, $value);
 }