public function let(CollegeInterface $repository, CollegeFactory $factory)
 {
     $college_to_save = new CollegeEntity();
     $factory->collegeEntity(array())->willReturn($college_to_save);
     $non_existing_college = new CollegeEntity();
     $non_existing_college->setId('non_existing');
     $factory->collegeEntity(array('name' => 'fails'))->willReturn($non_existing_college);
     $repository->getById(null)->willReturn(true);
     $repository->getById('non_existing')->willReturn(false);
     $repository->save(Argument::any())->willReturnArgument(0);
     $this->beConstructedWith($repository, $factory);
 }
Example #2
0
 public function let(CollegeInterface $repository, CollegeFactory $factory)
 {
     $college_to_save = new CollegeEntity();
     $factory->collegeEntity(array())->willReturn($college_to_save);
     $college_to_save_that_fails = new CollegeEntity();
     $college_to_save_that_fails->setName('Test');
     $college_to_save_that_fails->setNickname('Test');
     $factory->collegeEntity(array('name' => 'fails'))->willReturn($college_to_save_that_fails);
     $college_saved = new CollegeEntity();
     $college_saved->setName('Test');
     $college_saved->setNickname('Test');
     $repository->getByName(Argument::any())->willReturn($college_saved);
     $repository->save($college_to_save)->willReturnArgument(0);
     $this->beConstructedWith($repository, $factory);
 }