From 8a17e676834a55babc09453cfba7a257cf2bdfee Mon Sep 17 00:00:00 2001 From: markhuot Date: Tue, 16 Jan 2024 16:52:55 -0500 Subject: [PATCH] support @alias in Asset::factory()->source('@alias/something.md') --- src/factories/Asset.php | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/factories/Asset.php b/src/factories/Asset.php index d7b1a5d..9190709 100644 --- a/src/factories/Asset.php +++ b/src/factories/Asset.php @@ -2,6 +2,7 @@ namespace markhuot\craftpest\factories; +use craft\helpers\App; use craft\models\VolumeFolder; use Illuminate\Support\Collection; use markhuot\craftpest\test\RefreshesDatabase; @@ -92,7 +93,7 @@ public function definition(int $index = 0) if ($this->source) { $filename = basename($this->source); - file_put_contents($tempFile, file_get_contents($this->source)); + file_put_contents($tempFile, file_get_contents(App::parseEnv($this->source))); } else { $filename = 'asset'.mt_rand(1000, 9999).'.jpg'; file_put_contents($tempFile, file_get_contents(__DIR__.'/../../stubs/images/gray.jpg'));