public function testFindAllByData()
 {
     $data = [['field1' => 'value1']];
     $rows = [['row1'], ['row2']];
     $urlRewrites = [['urlRewrite1'], ['urlRewrite2']];
     $this->storage->expects($this->once())->method('doFindAllByData')->with($data)->will($this->returnValue($rows));
     $this->dataObjectHelper->expects($this->at(0))->method('populateWithArray')->with($urlRewrites[0], $rows[0], '\\Magento\\UrlRewrite\\Service\\V1\\Data\\UrlRewrite')->will($this->returnSelf());
     $this->urlRewriteFactory->expects($this->at(0))->method('create')->will($this->returnValue($urlRewrites[0]));
     $this->dataObjectHelper->expects($this->at(1))->method('populateWithArray')->with($urlRewrites[1], $rows[1], '\\Magento\\UrlRewrite\\Service\\V1\\Data\\UrlRewrite')->will($this->returnSelf());
     $this->urlRewriteFactory->expects($this->at(1))->method('create')->will($this->returnValue($urlRewrites[1]));
     $this->assertEquals($urlRewrites, $this->storage->findAllByData($data));
 }
예제 #2
0
 public function testFindAllByData()
 {
     $data = [['field1' => 'value1']];
     $rows = [['row1'], ['row2']];
     $urlRewrites = [['urlRewrite1'], ['urlRewrite2']];
     $this->storage->expects($this->once())->method('doFindAllByData')->with($data)->will($this->returnValue($rows));
     $this->urlRewriteBuilder->expects($this->at(0))->method('populateWithArray')->with($rows[0])->will($this->returnSelf());
     $this->urlRewriteBuilder->expects($this->at(1))->method('create')->will($this->returnValue($urlRewrites[0]));
     $this->urlRewriteBuilder->expects($this->at(2))->method('populateWithArray')->with($rows[1])->will($this->returnSelf());
     $this->urlRewriteBuilder->expects($this->at(3))->method('create')->will($this->returnValue($urlRewrites[1]));
     $this->assertEquals($urlRewrites, $this->storage->findAllByData($data));
 }