Exemplo n.º 1
0
 /**
  * @param HHPnet\Core\Domain\Albums\Album $album
  * @param MongoDB\UpdateResult            $upsert_result
  */
 public function it_fails_when_was_not_possible_to_save_album(Album $album, \MongoDB\UpdateResult $upsert_result)
 {
     $upsert_result->getUpsertedCount()->willReturn(0);
     $this->collection->updateOne(Argument::any(), Argument::any(), Argument::any())->willReturn($upsert_result);
     $album->getIterator()->willReturn(new \ArrayIterator(['id' => 1, 'group_id' => 1, 'name' => 'name_test', 'description' => 'description_test', 'release_year' => 2001]));
     $this->shouldThrow('\\DomainException')->during('save', array($album));
 }
Exemplo n.º 2
0
 /**
  * @param HHPnet\Core\Domain\Songs\Song $song
  * @param MongoDB\UpdateResult          $upsert_result
  */
 public function it_fails_when_was_not_possible_to_save_song(Song $song, \MongoDB\UpdateResult $upsert_result)
 {
     $upsert_result->getUpsertedCount()->willReturn(0);
     $this->collection->updateOne(Argument::any(), Argument::any(), Argument::any())->willReturn($upsert_result);
     $song->getIterator()->willReturn(new \ArrayIterator(['id' => 1, 'album_id' => 1, 'name' => 'test', 'type' => 'type_test', 'path' => 'path_test']));
     $this->shouldThrow('\\DomainException')->during('save', array($song));
 }
Exemplo n.º 3
0
 /**
  * @param HHPnet\Core\Domain\Videos\Video $video
  * @param MongoDB\UpdateResult            $upsert_result
  */
 public function it_fails_when_was_not_possible_to_save_video(\HHPnet\Core\Domain\Videos\Video $video, \MongoDB\UpdateResult $upsert_result)
 {
     $upsert_result->getUpsertedCount()->willReturn(0);
     $this->collection->updateOne(Argument::any(), Argument::any(), Argument::any())->willReturn($upsert_result);
     $video->getIterator()->willReturn(new \ArrayIterator(['id' => 1, 'video_service_id' => 'test', 'video_service' => 'youtube', 'title' => 'title', 'description' => 'desc']));
     $this->shouldThrow('\\DomainException')->during('save', array($video));
 }
Exemplo n.º 4
0
 /**
  * @param HHPnet\Core\Domain\Users\User $user
  * @param MongoDB\UpdateResult          $upsert_result
  */
 public function it_fails_when_was_not_possible_to_save_user(\HHPnet\Core\Domain\Users\User $user, \MongoDB\UpdateResult $upsert_result)
 {
     $upsert_result->getUpsertedCount()->willReturn(0);
     $this->collection->updateOne(Argument::any(), Argument::any(), Argument::any())->willReturn($upsert_result);
     $user->getIterator()->willReturn(new \ArrayIterator(['id' => 1, 'username' => 'test', 'email' => '*****@*****.**', 'password' => 'encrypted']));
     $this->shouldThrow('\\DomainException')->during('save', array($user));
 }
Exemplo n.º 5
0
 /**
  * @param HHPnet\Core\Domain\Groups\Group $group
  * @param MongoDB\UpdateResult            $upsert_result
  */
 public function it_fails_when_was_not_possible_to_save_group(\HHPnet\Core\Domain\Groups\Group $group, \MongoDB\UpdateResult $upsert_result)
 {
     $upsert_result->getUpsertedCount()->willReturn(0);
     $this->collection->updateOne(Argument::any(), Argument::any(), Argument::any())->willReturn($upsert_result);
     $group->getIterator()->willReturn(new \ArrayIterator(['id' => 1, 'name' => 'test', 'country' => 'country_test', 'bio' => 'bio_test']));
     $this->shouldThrow('\\DomainException')->during('save', array($group));
 }
 /**
  * @depends testUnacknowledgedWriteConcern
  * @expectedException MongoDB\Exception\BadMethodCallException
  * @expectedExceptionMessageRegExp /[\w:\\]+ should not be called for an unacknowledged write result/
  */
 public function testUnacknowledgedWriteConcernAccessesUpsertedId(UpdateResult $result)
 {
     $result->getUpsertedId();
 }