예제 #1
0
 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);
 }
예제 #2
0
 public function save(ConferenceEntity $conference)
 {
     $conference_info = $conference->getData();
     if (false !== $conference->hasId() && null !== ($id = $conference->getId())) {
         $conference_info['_id'] = new MongoId($id);
     } else {
         $conference_info['_id'] = new MongoId();
         $conference->setId($conference_info['_id']);
     }
     $conference_info['updated'] = new MongoDate();
     $this->collection->save($conference_info);
     return $conference;
 }
예제 #3
0
 public function it_should_be_possible_to_remove_given_conference()
 {
     $college = new ConferenceEntity();
     $college->setId('54312fd4c863c796148b458b');
     $this->remove($college)->shouldBe(true);
 }