Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Aug 19, 2023
1 parent 0e4d1bd commit dcb7e6a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 11 deletions.
1 change: 1 addition & 0 deletions phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,6 @@
</testsuites>
<php>
<ini name="memory_limit" value="256M"/>
<env name="CANVAS_FOR_LARAVEL" value="(true)"/>
</php>
</phpunit>
22 changes: 11 additions & 11 deletions src/LaravelServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use Illuminate\Contracts\Support\DeferrableProvider;
use Illuminate\Filesystem\Filesystem;
use Illuminate\Support\Arr;
use Illuminate\Support\Env;
use Illuminate\Support\ServiceProvider;
use Orchestra\Canvas\Core\Presets\Preset;
use Orchestra\Workbench\Workbench;
Expand Down Expand Up @@ -66,7 +67,7 @@ public function boot()

if (
\defined('TESTBENCH_WORKING_PATH')
|| $app->runningUnitTests()
|| Env::get('CANVAS_FOR_LARAVEL') === true
|| file_exists($app->basePath('canvas.yaml'))
) {
$artisan->add(new Commands\Channel($preset));
Expand Down Expand Up @@ -105,17 +106,16 @@ public function boot()
*/
protected function registerCanvasForWorkbench(Filesystem $filesystem): Preset
{
$config = ['preset' => Presets\PackageWorkbench::class, 'generators' => null];

if ($filesystem->exists(Workbench::packagePath('canvas.yaml'))) {
$yaml = Yaml::parseFile(Workbench::packagePath('canvas.yaml'));

$config['generators'] = $yaml['generators'] ?? [];
}

return Canvas::preset(
[
'preset' => Presets\PackageWorkbench::class,
'testing' => [
'extends' => ['unit' => 'PHPUnit\Framework\TestCase',
'feature' => 'Orchestra\Testbench\TestCase',
],
],
],
rtrim(Workbench::packagePath(), DIRECTORY_SEPARATOR),
$filesystem
$config, rtrim(Workbench::packagePath(), DIRECTORY_SEPARATOR), $filesystem
);
}

Expand Down

0 comments on commit dcb7e6a

Please sign in to comment.