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 Oct 9, 2023
1 parent 99e902b commit ec9ca51
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 7 deletions.
15 changes: 8 additions & 7 deletions tests/Concerns/UsesGeneratorOverridesTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
namespace Orchestra\Canvas\Core\Tests\Concerns;

use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Filesystem\Filesystem;
use Orchestra\Canvas\Core\Concerns\UsesGeneratorOverrides;
use Orchestra\Canvas\Core\PresetManager;
use Orchestra\Canvas\Core\Presets\Preset;
Expand All @@ -15,9 +16,14 @@ class UsesGeneratorOverridesTest extends TestCase
*/
protected function setUp(): void
{
$this->beforeApplicationDestroyed(function () {
$filesystem = new Filesystem();
$filesystem = new Filesystem();

$this->afterApplicationCreated(static function () use ($filesystem) {
$filesystem->ensureDirectoryExists(base_path('app/Events'));
$filesystem->ensureDirectoryExists(base_path('app/Models'));
});

$this->beforeApplicationDestroyed(static function () use ($filesystem) {
$filesystem->deleteDirectory(base_path('app/Events'));
$filesystem->deleteDirectory(base_path('app/Models'));
});
Expand All @@ -28,11 +34,6 @@ protected function setUp(): void
/** @test */
public function it_can_get_qualify_model_class()
{
$filesystem = $this->app['files'];

$filesystem->ensureDirectoryExists(base_path('app/Events'));
$filesystem->ensureDirectoryExists(base_path('app/Models'));

$stub = new UsesGeneratorOverridesTestStub();

$this->assertSame([
Expand Down
21 changes: 21 additions & 0 deletions tests/Presets/LaravelPresetTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace Orchestra\Canvas\Core\Tests;

use Illuminate\Filesystem\Filesystem;
use Orchestra\Canvas\Core\PresetManager;
use Orchestra\Canvas\Core\Presets\Laravel;
use Orchestra\Testbench\Concerns\WithWorkbench;
Expand All @@ -11,6 +12,26 @@ class LaravelPresetTest extends TestCase
{
use WithWorkbench;

/**
* Setup the test environment.
*/
protected function setUp(): void
{
$filesystem = new Filesystem();

$this->afterApplicationCreated(static function () use ($filesystem) {
$filesystem->ensureDirectoryExists(base_path('app/Events'));
$filesystem->ensureDirectoryExists(base_path('app/Models'));
});

$this->beforeApplicationDestroyed(static function () use ($filesystem) {
$filesystem->deleteDirectory(base_path('app/Events'));
$filesystem->deleteDirectory(base_path('app/Models'));
});

parent::setUp();
}

/** @test */
public function it_can_be_resolved()
{
Expand Down

0 comments on commit ec9ca51

Please sign in to comment.