Skip to content

Commit

Permalink
Fix tests. need to find another way to set faker.
Browse files Browse the repository at this point in the history
  • Loading branch information
aerni committed Aug 30, 2024
1 parent 1db91e9 commit 4514088
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/Factories/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,6 +158,11 @@ protected function getExpandedAttributes(): array
return $this->expandAttributes($this->getRawAttributes());
}

/**
* TODO: Overriding of attributes doesn't work anymore.
* Need to find a way to see if there's a site attribute in the states, then set the faker to that site.
* And then evaluate all the states.
*/
protected function getRawAttributes(): array
{
$definition = $this->states->reduce(function (array $carry, $state) {
Expand All @@ -168,9 +173,7 @@ protected function getRawAttributes(): array
return array_merge($carry, $state($carry));
}, $this->definition());

$this->faker = $this->withFaker(Arr::get($definition, 'site'));

return array_merge($definition, $this->definition());
return $definition;
}

protected function expandAttributes(array $definition)
Expand Down

0 comments on commit 4514088

Please sign in to comment.