public function testFindAllByData()
 {
     $data = ['col1' => 'val1', 'col2' => 'val2'];
     $this->select->expects($this->at(1))->method('where')->with('col1 IN (?)', 'val1');
     $this->select->expects($this->at(2))->method('where')->with('col2 IN (?)', 'val2');
     $this->connectionMock->expects($this->any())->method('quoteIdentifier')->will($this->returnArgument(0));
     $this->connectionMock->expects($this->once())->method('fetchAll')->with($this->select)->will($this->returnValue([['row1'], ['row2']]));
     $this->dataObjectHelper->expects($this->at(0))->method('populateWithArray')->with(['urlRewrite1'], ['row1'], '\\Magento\\UrlRewrite\\Service\\V1\\Data\\UrlRewrite')->will($this->returnSelf());
     $this->urlRewriteFactory->expects($this->at(0))->method('create')->will($this->returnValue(['urlRewrite1']));
     $this->dataObjectHelper->expects($this->at(1))->method('populateWithArray')->with(['urlRewrite2'], ['row2'], '\\Magento\\UrlRewrite\\Service\\V1\\Data\\UrlRewrite')->will($this->returnSelf());
     $this->urlRewriteFactory->expects($this->at(1))->method('create')->will($this->returnValue(['urlRewrite2']));
     $this->assertEquals([['urlRewrite1'], ['urlRewrite2']], $this->storage->findAllByData($data));
 }
Beispiel #2
0
 public function testFindAllByData()
 {
     $data = ['col1' => 'val1', 'col2' => 'val2'];
     $this->select->expects($this->at(1))->method('where')->with('col1 IN (?)', 'val1');
     $this->select->expects($this->at(2))->method('where')->with('col2 IN (?)', 'val2');
     $this->adapter->expects($this->any())->method('quoteIdentifier')->will($this->returnArgument(0));
     $this->adapter->expects($this->once())->method('fetchAll')->with($this->select)->will($this->returnValue([['row1'], ['row2']]));
     $this->urlRewriteBuilder->expects($this->at(0))->method('populateWithArray')->with(['row1'])->will($this->returnSelf());
     $this->urlRewriteBuilder->expects($this->at(1))->method('create')->will($this->returnValue(['urlRewrite1']));
     $this->urlRewriteBuilder->expects($this->at(2))->method('populateWithArray')->with(['row2'])->will($this->returnSelf());
     $this->urlRewriteBuilder->expects($this->at(3))->method('create')->will($this->returnValue(['urlRewrite2']));
     $this->assertEquals([['urlRewrite1'], ['urlRewrite2']], $this->storage->findAllByData($data));
 }
 /**
  * {@inheritdoc}
  */
 public function findAllByData(array $data)
 {
     $pluginInfo = $this->pluginList->getNext($this->subjectType, 'findAllByData');
     if (!$pluginInfo) {
         return parent::findAllByData($data);
     } else {
         return $this->___callPlugins('findAllByData', func_get_args(), $pluginInfo);
     }
 }