Beispiel #1
0
 /**
  * @param HHPnet\Core\Domain\Songs\Song $song
  * @param MongoDB\DeleteResult          $delete_result
  */
 public function it_is_possible_to_remove_given_song(Song $song, \MongoDB\DeleteResult $delete_result)
 {
     $delete_result->getDeletedCount()->willReturn(1);
     $this->collection->deleteOne(Argument::any())->willReturn($delete_result);
     $song->getId()->willReturn(1);
     $this->remove($song)->shouldBe(true);
 }
Beispiel #2
0
 /**
  * @param \HHPnet\Core\Domain\Songs\Song    $song
  * @param HHPnet\Core\Domain\Albums\AlbumId $album_id
  */
 public function let(Song $song, AlbumId $album_id)
 {
     $album_id->__toString()->willReturn('1');
     $song->getId()->willReturn(1);
     $song->getAlbumId()->willReturn($album_id);
     $song->getName()->willReturn('name');
     $song->getType()->willReturn('type');
     $song->getPath()->willReturn('path');
     $this->beConstructedWith($song);
 }
Beispiel #3
0
 /**
  * @return string
  */
 public function path()
 {
     return $this->song->getPath();
 }
Beispiel #4
0
 /**
  * @param Song $song
  *
  * @return bool
  */
 public function remove(Song $song)
 {
     return 1 === $this->collection->deleteOne(['_id' => $song->getId()])->getDeletedCount();
 }