generated from spatie/package-skeleton-php
-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add support for class based factorise
- Loading branch information
1 parent
1d7527a
commit 4dd8b6e
Showing
5 changed files
with
107 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
<?php | ||
|
||
namespace Morrislaptop\PopoFactory\Tests\Popos; | ||
|
||
use Morrislaptop\PopoFactory\PopoFactory; | ||
|
||
/** | ||
* @method PersonData make | ||
*/ | ||
class PersonDataFactory extends PopoFactory | ||
{ | ||
public static function factory(): static | ||
{ | ||
return static::new(PersonData::class)->state([ | ||
'firstName' => 'Craig', | ||
]); | ||
} | ||
|
||
public function gotNoJob() | ||
{ | ||
return $this->state([ | ||
'companyName' => null, | ||
]); | ||
} | ||
|
||
public function worksAtHome() | ||
{ | ||
return $this->state(function ($attributes) { | ||
return [ | ||
'workAddress' => $attributes['homeAddress'], | ||
]; | ||
}); | ||
} | ||
} |