public function testRepeatAndPersist() { $another = new Author('spock'); $source = $this->getMockBuilder('Trismegiste\\Socialist\\Publishing')->setConstructorArgs([$another])->setMethods(null)->getMock(); $pk = '54390582e3f43405428b4568'; $this->repository->expects($this->once())->method('findByPk')->with($this->equalTo($pk))->will($this->returnValue($source)); $this->repository->expects($this->once())->method('persist'); $this->sut->repeatPublishing($pk); }
public function testRetweet() { $id = '54390582e3f43405428b4568'; $this->repository->expects($this->once())->method('findByPk')->with($this->equalTo($id))->will($this->returnValue(new \Trismegiste\Socialist\SmallTalk(new Author('spock')))); $this->repository->expects($this->once())->method('findOne')->willReturn(null); $retweet = $this->sut->repeatPublishing($id); $this->assertInstanceOf('Trismegiste\\Socialist\\Repeat', $retweet); }