Skip to content

Commit ecca77f

Browse files
committed
wip
1 parent 8f1e845 commit ecca77f

File tree

13 files changed

+81
-17
lines changed

13 files changed

+81
-17
lines changed

src/Console/Commands/Install.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,5 +41,7 @@ public function handle(): void
4141
'--provider' => RootServiceProvider::class,
4242
'--tag' => 'root-stubs',
4343
]);
44+
45+
$this->info('Root has been installed.');
4446
}
4547
}

src/Console/Commands/Publish.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ public function handle(): void
3737
$this->option('force') ? ['--force' => true] : [],
3838
['--tag' => $this->option('tag') ?: ['root-compiled']]
3939
));
40+
41+
$this->info('Root files has been publised.');
4042
}
4143

4244
/**

stubs/RootServiceProvider.stub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
namespace {{ namespace }}Providers;
44

55
use {{ namespace }}Models\User;
6-
use {{ namespace }}Root\Resources\UserResource;
6+
use {{ namespace }}Root\Resources\UserResource;
77
use Cone\Root\Interfaces\Models\User as UserInterface;
88
use Cone\Root\Root;
99
use Cone\Root\Widgets\Welcome;

tests/Console/ActionMakeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Cone\Root\Tests\TestCase;
66
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\File;
78

89
class ActionMakeTest extends TestCase
910
{
10-
public function test_an_action_make_command_creates_action(): void
11+
public function test_action_make_command(): void
1112
{
1213
$this->artisan('root:action', ['name' => 'TestAction'])
1314
->assertExitCode(Command::SUCCESS);
@@ -17,7 +18,7 @@ public function test_an_action_make_command_creates_action(): void
1718

1819
public function tearDown(): void
1920
{
20-
unlink($this->app->path('/Root/Actions/TestAction.php'));
21+
File::delete($this->app->path('Root/Actions/TestAction.php'));
2122

2223
parent::tearDown();
2324
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
use Illuminate\Http\UploadedFile;
88
use Illuminate\Support\Facades\Storage;
99

10-
class CommandsTest extends TestCase
10+
class ClearChunkTest extends TestCase
1111
{
12-
public function test_a_command_can_clear_chunks(): void
12+
public function test_clear_chunk_command(): void
1313
{
1414
Storage::disk('local')->putFileAs(
1515
'',

tests/Console/FieldMakeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Cone\Root\Tests\TestCase;
66
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\File;
78

89
class FieldMakeTest extends TestCase
910
{
10-
public function test_a_field_make_command_creates_field(): void
11+
public function test_field_make_command(): void
1112
{
1213
$this->artisan('root:field', [
1314
'name' => 'TestField',
@@ -20,7 +21,7 @@ public function test_a_field_make_command_creates_field(): void
2021

2122
public function tearDown(): void
2223
{
23-
unlink($this->app->path('/Root/Fields/TestField.php'));
24+
File::delete($this->app->path('Root/Fields/TestField.php'));
2425

2526
parent::tearDown();
2627
}

tests/Console/FilterMakeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Cone\Root\Tests\TestCase;
66
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\File;
78

89
class FilterMakeTest extends TestCase
910
{
10-
public function test_a_filter_make_command_creates_filter(): void
11+
public function test_filter_make_command(): void
1112
{
1213
$this->artisan('root:filter', [
1314
'name' => 'TestFilter',
@@ -21,7 +22,7 @@ public function test_a_filter_make_command_creates_filter(): void
2122

2223
public function tearDown(): void
2324
{
24-
unlink($this->app->path('/Root/Filters/TestFilter.php'));
25+
File::delete($this->app->path('Root/Filters/TestFilter.php'));
2526

2627
parent::tearDown();
2728
}

tests/Console/InstallTest.php

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
<?php
2+
3+
namespace Cone\Root\Tests\Console;
4+
5+
use Cone\Root\Tests\TestCase;
6+
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\File;
8+
9+
class InstallTest extends TestCase
10+
{
11+
public function test_install_command(): void
12+
{
13+
$this->artisan('root:install', ['--seed' => true])
14+
->expectsOutput('Root has been installed.')
15+
->assertExitCode(Command::SUCCESS);
16+
17+
$this->assertDirectoryExists($this->app->storagePath('framework/testing/disks/local/root-tmp'));
18+
}
19+
20+
public function tearDown(): void
21+
{
22+
File::deleteDirectory($this->app->path('Root'));
23+
File::delete($this->app->path('Providers/RootServiceProvider.php'));
24+
25+
parent::tearDown();
26+
}
27+
}

tests/Console/PublishTest.php

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
<?php
2+
3+
namespace Cone\Root\Tests\Console;
4+
5+
use Cone\Root\Tests\TestCase;
6+
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\File;
8+
9+
class PublishTest extends TestCase
10+
{
11+
public function test_publish_command(): void
12+
{
13+
$this->artisan('root:publish', ['--packages' => true])
14+
->expectsOutput('Root files has been publised.')
15+
->assertExitCode(Command::SUCCESS);
16+
17+
$this->assertDirectoryExists($this->app->publicPath('vendor/root'));
18+
}
19+
20+
public function tearDown(): void
21+
{
22+
File::deleteDirectory($this->app->publicPath('vendor'));
23+
24+
parent::tearDown();
25+
}
26+
}

tests/Console/ResourceMakeTest.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,11 @@
44

55
use Cone\Root\Tests\TestCase;
66
use Illuminate\Console\Command;
7+
use Illuminate\Support\Facades\File;
78

89
class ResourceMakeTest extends TestCase
910
{
10-
public function test_a_resource_make_command_creates_resource(): void
11+
public function test_resource_make_command(): void
1112
{
1213
$this->artisan('root:resource', ['name' => 'TestResource'])
1314
->assertExitCode(Command::SUCCESS);
@@ -17,7 +18,7 @@ public function test_a_resource_make_command_creates_resource(): void
1718

1819
public function tearDown(): void
1920
{
20-
unlink($this->app->path('/Root/Resources/TestResource.php'));
21+
File::delete($this->app->path('Root/Resources/TestResource.php'));
2122

2223
parent::tearDown();
2324
}

0 commit comments

Comments
 (0)