forked from zenstruck/foundry
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
a wip to fix using stories with objects that can't be persisted This is intended to be legacy code that shouldn't be merged / released in 2.x. fixes: zenstruck#573
- Loading branch information
Showing
5 changed files
with
72 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,29 @@ | ||
<?php | ||
|
||
namespace Zenstruck\Foundry\Tests\Fixtures\Factories; | ||
|
||
use Zenstruck\Foundry\ModelFactory; | ||
use Zenstruck\Foundry\Tests\Fixtures\Object\SomeObject; | ||
|
||
/** | ||
* @author Jesse Rushlow <jr@rushlow.dev> | ||
*/ | ||
class LegacyObjectFactory extends ModelFactory | ||
{ | ||
protected static function getClass(): string | ||
{ | ||
return SomeObject::class; | ||
} | ||
|
||
protected function getDefaults(): array | ||
{ | ||
return [ | ||
'propertyWithoutType' => self::faker()->word(), | ||
]; | ||
} | ||
|
||
protected function initialize(): self | ||
{ | ||
return $this->withoutPersisting(); | ||
} | ||
} |
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,20 @@ | ||
<?php | ||
|
||
namespace Zenstruck\Foundry\Tests\Fixtures\Stories; | ||
|
||
use Zenstruck\Foundry\Story; | ||
use Zenstruck\Foundry\Tests\Fixtures\Factories\LegacyObjectFactory; | ||
use Zenstruck\Foundry\Tests\Fixtures\Object\SomeObject; | ||
|
||
/** | ||
* @author Jesse Rushlow <jr@rushlow.dev> | ||
* | ||
* @method static SomeObject simpleObject() | ||
*/ | ||
class LegacyObjectStory extends Story | ||
{ | ||
public function build(): void | ||
{ | ||
$this->addState('simpleObject', LegacyObjectFactory::createOne()); | ||
} | ||
} |
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