Exemplo n.º 1
0
 /**
  * Create entity and populate with dummy data.
  *
  * @param string $type
  * @param array  $fields
  * @return array
  */
 public function build($type, $fields = [])
 {
     $data = $this->mergeFixtureWithOverrides($type, $fields);
     // We'll pass off the process of creating the entity.
     // This way, folks can use different persistence layers.
     return $this->database->build($type, $data);
 }
Exemplo n.º 2
0
 function it_can_create_multiple_entities_at_once(BuildableRepositoryInterface $builderRepository)
 {
     $stub = new AlbumStub();
     $builderRepository->build(Argument::type('string'), Argument::type('array'))->shouldBeCalledTimes(3)->willReturn($stub);
     $builderRepository->save($stub)->shouldBeCalledTimes(3);
     $this->setTimes(3)->create('Album')->shouldReturn([$stub, $stub, $stub]);
 }