public function let(ConferenceInterface $repository, ConferenceFactory $factory)
 {
     $conference_to_save = new ConferenceEntity();
     $factory->conferenceEntity(array())->willReturn($conference_to_save);
     $conference_to_save_that_fails = new ConferenceEntity();
     $conference_to_save_that_fails->setName('Test');
     $factory->conferenceEntity(array('name' => 'fails'))->willReturn($conference_to_save_that_fails);
     $repository->getByName(null)->willReturn(false);
     $repository->save($conference_to_save)->willReturnArgument(0);
     $this->beConstructedWith($repository, $factory);
 }
 public function let(ConferenceInterface $repository, ConferenceFactory $factory)
 {
     $conference_to_save = new ConferenceEntity();
     $factory->conferenceEntity(array())->willReturn($conference_to_save);
     $non_existing_conference = new ConferenceEntity();
     $non_existing_conference->setId('non_existing');
     $factory->conferenceEntity(array('name' => 'fails'))->willReturn($non_existing_conference);
     $repository->getById(null)->willReturn(true);
     $repository->getById('non_existing')->willReturn(false);
     $repository->save(Argument::any())->willReturnArgument(0);
     $this->beConstructedWith($repository, $factory);
 }
Example #3
0
 public function remove(ConferenceEntity $conference)
 {
     $id = $conference->getId();
     return !empty($id) ? $this->collection->remove(array('_id' => new MongoId($id))) : null;
 }
Example #4
0
 public function it_should_be_possible_to_remove_given_conference()
 {
     $college = new ConferenceEntity();
     $college->setId('54312fd4c863c796148b458b');
     $this->remove($college)->shouldBe(true);
 }