コード例 #1
0
 /**
  * @test
  */
 public function testDeleteById()
 {
     $pageId = '123';
     $this->page->expects($this->once())->method('getId')->willReturn(true);
     $this->page->expects($this->once())->method('load')->with($pageId)->willReturnSelf();
     $this->pageResource->expects($this->once())->method('delete')->with($this->page)->willReturnSelf();
     $this->assertTrue($this->repository->deleteById($pageId));
 }
コード例 #2
0
 /**
  * Run test deleteById method
  *
  * @return void
  */
 public function testDeleteById()
 {
     $id = 20;
     $pageMock = $this->getMockForAbstractClass('Magento\\Cms\\Model\\Page', [], '', false, true, true, ['getId']);
     $this->pageFactoryMock->expects($this->once())->method('create')->will($this->returnValue($pageMock));
     $this->resourceMock->expects($this->once())->method('load')->with($pageMock, $id);
     $pageMock->expects($this->once())->method('getId')->will($this->returnValue($id));
     $this->resourceMock->expects($this->once())->method('delete')->with($pageMock);
     $this->assertTrue($this->pageRepository->deleteById($id));
 }