Skip to content

Commit 564919c

Browse files
committed
fix:tests
1 parent 27a6308 commit 564919c

File tree

2 files changed

+19
-10
lines changed

2 files changed

+19
-10
lines changed

tests/CommandTest.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55
use Carbon\Carbon;
66
use Illuminate\Support\Facades\Config;
77
use org\bovigo\vfs\vfsStream;
8+
use org\bovigo\vfs\vfsStreamFile;
89
use RonasIT\Support\Exceptions\ClassNotExistsException;
910
use RonasIT\Support\Tests\Support\Command\CommandMockTrait;
1011
use UnexpectedValueException;
@@ -13,6 +14,18 @@ class CommandTest extends TestCase
1314
{
1415
use CommandMockTrait;
1516

17+
public function setUp(): void
18+
{
19+
parent::setUp();
20+
21+
vfsStream::newDirectory('config')->at($this->rootDirectory);
22+
$routesDir = vfsStream::newDirectory('routes')->at($this->rootDirectory);
23+
24+
$apiRoute = new vfsStreamFile('api.php');
25+
26+
$routesDir->addChild($apiRoute);
27+
}
28+
1629
public function testCallWithInvalidCrudOption()
1730
{
1831
$this->assertExceptionThrew(

tests/TestCase.php

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
use Illuminate\Support\Str;
1010
use Orchestra\Testbench\TestCase as BaseTestCase;
1111
use org\bovigo\vfs\vfsStream;
12+
use org\bovigo\vfs\vfsStreamDirectory;
1213
use RonasIT\Support\EntityGeneratorServiceProvider;
1314
use RonasIT\Support\Traits\FixturesTrait;
1415
use org\bovigo\vfs\vfsStreamFile;
@@ -21,24 +22,19 @@ class TestCase extends BaseTestCase
2122
protected bool $globalExportMode = false;
2223
protected string $generatedFileBasePath;
2324

25+
protected vfsStreamDirectory $rootDirectory;
26+
2427
public function setUp(): void
2528
{
2629
parent::setUp();
2730

2831
$this->mockConfigurations();
2932

30-
$root = vfsStream::setup();
31-
32-
vfsStream::newDirectory('config')->at($root);
33-
$routesDir = vfsStream::newDirectory('routes')->at($root);
34-
35-
$apiRoute = new vfsStreamFile('api.php');
36-
37-
$routesDir->addChild($apiRoute);
38-
39-
Event::fake();
33+
$this->rootDirectory = vfsStream::setup();
4034

4135
$this->generatedFileBasePath = vfsStream::url('root');
36+
37+
Event::fake();
4238

4339
$this->app->setBasePath($this->generatedFileBasePath);
4440
}

0 commit comments

Comments
 (0)