Ejemplo n.º 1
0
 public function deleteById($id)
 {
     $postModel = $this->_postRegistry->retrieve($id);
     $postModel->delete();
     $this->_postRegistry->remove($id);
     return true;
 }
Ejemplo n.º 2
0
 public function testRemove()
 {
     $this->postFactory->expects($this->exactly(2))->method('create')->willReturn($this->post);
     $this->post->expects($this->exactly(2))->method('load')->willReturn($this->post);
     $this->post->expects($this->exactly(3))->method('getId')->willReturn(self::POST_ID);
     $this->post->expects($this->exactly(3))->method('getUrlKey')->willReturn(self::URL);
     $actual = $this->postRegistry->retrieve(self::POST_ID);
     $this->assertSame($this->post, $actual);
     $this->postRegistry->remove(self::POST_ID);
     $actual = $this->postRegistry->retrieve(self::POST_ID);
     $this->assertSame($this->post, $actual);
 }