Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgergo committed Nov 13, 2024
1 parent 8f1e845 commit ecca77f
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 17 deletions.
2 changes: 2 additions & 0 deletions src/Console/Commands/Install.php
Original file line number Diff line number Diff line change
Expand Up @@ -41,5 +41,7 @@ public function handle(): void
'--provider' => RootServiceProvider::class,
'--tag' => 'root-stubs',
]);

$this->info('Root has been installed.');
}
}
2 changes: 2 additions & 0 deletions src/Console/Commands/Publish.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,8 @@ public function handle(): void
$this->option('force') ? ['--force' => true] : [],
['--tag' => $this->option('tag') ?: ['root-compiled']]
));

$this->info('Root files has been publised.');

Check warning on line 41 in src/Console/Commands/Publish.php

View workflow job for this annotation

GitHub Actions / 文A Typos check

"publised" should be "published".
}

/**
Expand Down
2 changes: 1 addition & 1 deletion stubs/RootServiceProvider.stub
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
namespace {{ namespace }}Providers;

use {{ namespace }}Models\User;
use {{ namespace }}Root\Resources\UserResource;
use {{ namespace }}Root\Resources\UserResource;
use Cone\Root\Interfaces\Models\User as UserInterface;
use Cone\Root\Root;
use Cone\Root\Widgets\Welcome;
Expand Down
5 changes: 3 additions & 2 deletions tests/Console/ActionMakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Cone\Root\Tests\TestCase;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class ActionMakeTest extends TestCase
{
public function test_an_action_make_command_creates_action(): void
public function test_action_make_command(): void
{
$this->artisan('root:action', ['name' => 'TestAction'])
->assertExitCode(Command::SUCCESS);
Expand All @@ -17,7 +18,7 @@ public function test_an_action_make_command_creates_action(): void

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

parent::tearDown();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@
use Illuminate\Http\UploadedFile;
use Illuminate\Support\Facades\Storage;

class CommandsTest extends TestCase
class ClearChunkTest extends TestCase
{
public function test_a_command_can_clear_chunks(): void
public function test_clear_chunk_command(): void
{
Storage::disk('local')->putFileAs(
'',
Expand Down
5 changes: 3 additions & 2 deletions tests/Console/FieldMakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Cone\Root\Tests\TestCase;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class FieldMakeTest extends TestCase
{
public function test_a_field_make_command_creates_field(): void
public function test_field_make_command(): void
{
$this->artisan('root:field', [
'name' => 'TestField',
Expand All @@ -20,7 +21,7 @@ public function test_a_field_make_command_creates_field(): void

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

parent::tearDown();
}
Expand Down
5 changes: 3 additions & 2 deletions tests/Console/FilterMakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Cone\Root\Tests\TestCase;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class FilterMakeTest extends TestCase
{
public function test_a_filter_make_command_creates_filter(): void
public function test_filter_make_command(): void
{
$this->artisan('root:filter', [
'name' => 'TestFilter',
Expand All @@ -21,7 +22,7 @@ public function test_a_filter_make_command_creates_filter(): void

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

parent::tearDown();
}
Expand Down
27 changes: 27 additions & 0 deletions tests/Console/InstallTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
<?php

namespace Cone\Root\Tests\Console;

use Cone\Root\Tests\TestCase;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class InstallTest extends TestCase
{
public function test_install_command(): void
{
$this->artisan('root:install', ['--seed' => true])
->expectsOutput('Root has been installed.')
->assertExitCode(Command::SUCCESS);

$this->assertDirectoryExists($this->app->storagePath('framework/testing/disks/local/root-tmp'));
}

public function tearDown(): void
{
File::deleteDirectory($this->app->path('Root'));
File::delete($this->app->path('Providers/RootServiceProvider.php'));

parent::tearDown();
}
}
26 changes: 26 additions & 0 deletions tests/Console/PublishTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
<?php

namespace Cone\Root\Tests\Console;

use Cone\Root\Tests\TestCase;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class PublishTest extends TestCase
{
public function test_publish_command(): void
{
$this->artisan('root:publish', ['--packages' => true])
->expectsOutput('Root files has been publised.')

Check warning on line 14 in tests/Console/PublishTest.php

View workflow job for this annotation

GitHub Actions / 文A Typos check

"publised" should be "published".
->assertExitCode(Command::SUCCESS);

$this->assertDirectoryExists($this->app->publicPath('vendor/root'));
}

public function tearDown(): void
{
File::deleteDirectory($this->app->publicPath('vendor'));

parent::tearDown();
}
}
5 changes: 3 additions & 2 deletions tests/Console/ResourceMakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Cone\Root\Tests\TestCase;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class ResourceMakeTest extends TestCase
{
public function test_a_resource_make_command_creates_resource(): void
public function test_resource_make_command(): void
{
$this->artisan('root:resource', ['name' => 'TestResource'])
->assertExitCode(Command::SUCCESS);
Expand All @@ -17,7 +18,7 @@ public function test_a_resource_make_command_creates_resource(): void

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

parent::tearDown();
}
Expand Down
5 changes: 3 additions & 2 deletions tests/Console/TrendMakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Cone\Root\Tests\TestCase;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class TrendMakeTest extends TestCase
{
public function test_a_trend_make_command_creates_trend_widget(): void
public function test_trend_make_command(): void
{
$this->artisan('root:trend', ['name' => 'TrendWidget'])
->assertExitCode(Command::SUCCESS);
Expand All @@ -17,7 +18,7 @@ public function test_a_trend_make_command_creates_trend_widget(): void

public function tearDown(): void
{
unlink($this->app->path('/Root/Widgets/TrendWidget.php'));
File::delete($this->app->path('Root/Widgets/TrendWidget.php'));

parent::tearDown();
}
Expand Down
5 changes: 3 additions & 2 deletions tests/Console/ValueMakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Cone\Root\Tests\TestCase;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class ValueMakeTest extends TestCase
{
public function test_a_value_make_command_creates_value_widget(): void
public function test_value_make_command(): void
{
$this->artisan('root:value', ['name' => 'ValueWidget'])
->assertExitCode(Command::SUCCESS);
Expand All @@ -17,7 +18,7 @@ public function test_a_value_make_command_creates_value_widget(): void

public function tearDown(): void
{
unlink($this->app->path('/Root/Widgets/ValueWidget.php'));
File::delete($this->app->path('Root/Widgets/ValueWidget.php'));

parent::tearDown();
}
Expand Down
5 changes: 3 additions & 2 deletions tests/Console/WidgetMakeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,11 @@

use Cone\Root\Tests\TestCase;
use Illuminate\Console\Command;
use Illuminate\Support\Facades\File;

class WidgetMakeTest extends TestCase
{
public function test_a_widget_make_command_creates_widget(): void
public function test_widget_make_command(): void
{
$this->artisan('root:widget', ['name' => 'TestWidget'])
->assertExitCode(Command::SUCCESS);
Expand All @@ -17,7 +18,7 @@ public function test_a_widget_make_command_creates_widget(): void

public function tearDown(): void
{
unlink($this->app->path('/Root/Widgets/TestWidget.php'));
File::delete($this->app->path('Root/Widgets/TestWidget.php'));

parent::tearDown();
}
Expand Down

0 comments on commit ecca77f

Please sign in to comment.