Skip to content

Commit

Permalink
Fixing Code style
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Nov 10, 2020
1 parent 850931b commit e2975f8
Show file tree
Hide file tree
Showing 8 changed files with 79 additions and 76 deletions.
1 change: 0 additions & 1 deletion config/config.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

use Nwidart\Modules\Activators\FileActivator;


return [

/*
Expand Down
24 changes: 11 additions & 13 deletions src/Commands/ModuleMakeCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -75,26 +75,24 @@ protected function getOptions()
];
}

/**
* Get module type .
*
* @return string
*/
private function getModuleType(){

/**
* Get module type .
*
* @return string
*/
private function getModuleType()
{
$isPlain = $this->option('plain');
$isApi = $this->option('api');

if( $isPlain && $isApi ){
if ($isPlain && $isApi) {
return 'web';
}
if( $isPlain ){
if ($isPlain) {
return 'plain';
}
elseif( $isApi ){
} elseif ($isApi) {
return 'api';
}
else{
} else {
return 'web';
}
}
Expand Down
65 changes: 32 additions & 33 deletions src/Providers/ConsoleServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,54 @@

namespace Nwidart\Modules\Providers;

use Illuminate\Support\Str;
use Illuminate\Support\ServiceProvider;
use Nwidart\Modules\Commands\UseCommand;
use Illuminate\Support\Str;
use Nwidart\Modules\Commands\CommandMakeCommand;
use Nwidart\Modules\Commands\ControllerMakeCommand;
use Nwidart\Modules\Commands\DisableCommand;
use Nwidart\Modules\Commands\DumpCommand;
use Nwidart\Modules\Commands\ListCommand;
use Nwidart\Modules\Commands\SeedCommand;
use Nwidart\Modules\Commands\SetupCommand;
use Nwidart\Modules\Commands\UnUseCommand;
use Nwidart\Modules\Commands\EnableCommand;
use Nwidart\Modules\Commands\UpdateCommand;
use Nwidart\Modules\Commands\DisableCommand;
use Nwidart\Modules\Commands\InstallCommand;
use Nwidart\Modules\Commands\JobMakeCommand;
use Nwidart\Modules\Commands\MigrateCommand;
use Nwidart\Modules\Commands\PublishCommand;
use Nwidart\Modules\Commands\MailMakeCommand;
use Nwidart\Modules\Commands\RuleMakeCommand;
use Nwidart\Modules\Commands\SeedMakeCommand;
use Nwidart\Modules\Commands\TestMakeCommand;
use Nwidart\Modules\Commands\EventMakeCommand;
use Nwidart\Modules\Commands\ModelMakeCommand;
use Nwidart\Modules\Commands\ModuleMakeCommand;
use Nwidart\Modules\Commands\PolicyMakeCommand;
use Nwidart\Modules\Commands\CommandMakeCommand;
use Nwidart\Modules\Commands\FactoryMakeCommand;
use Nwidart\Modules\Commands\RequestMakeCommand;
use Nwidart\Modules\Commands\InstallCommand;
use Nwidart\Modules\Commands\JobMakeCommand;
use Nwidart\Modules\Commands\LaravelModulesV6Migrator;
use Nwidart\Modules\Commands\ListCommand;
use Nwidart\Modules\Commands\ListenerMakeCommand;
use Nwidart\Modules\Commands\MigrateResetCommand;
use Nwidart\Modules\Commands\ModuleDeleteCommand;
use Nwidart\Modules\Commands\ProviderMakeCommand;
use Nwidart\Modules\Commands\ResourceMakeCommand;
use Nwidart\Modules\Commands\MigrateStatusCommand;
use Nwidart\Modules\Commands\MigrationMakeCommand;
use Nwidart\Modules\Commands\ControllerMakeCommand;
use Nwidart\Modules\Commands\MailMakeCommand;
use Nwidart\Modules\Commands\MiddlewareMakeCommand;
use Nwidart\Modules\Commands\MigrateCommand;
use Nwidart\Modules\Commands\MigrateRefreshCommand;
use Nwidart\Modules\Commands\MigrateResetCommand;
use Nwidart\Modules\Commands\MigrateRollbackCommand;
use Nwidart\Modules\Commands\MigrateStatusCommand;
use Nwidart\Modules\Commands\MigrationMakeCommand;
use Nwidart\Modules\Commands\ModelMakeCommand;
use Nwidart\Modules\Commands\ModuleDeleteCommand;
use Nwidart\Modules\Commands\ModuleMakeCommand;
use Nwidart\Modules\Commands\NotificationMakeCommand;
use Nwidart\Modules\Commands\PolicyMakeCommand;
use Nwidart\Modules\Commands\ProviderMakeCommand;
use Nwidart\Modules\Commands\PublishCommand;
use Nwidart\Modules\Commands\PublishConfigurationCommand;
use Nwidart\Modules\Commands\PublishMigrationCommand;
use Nwidart\Modules\Commands\LaravelModulesV6Migrator;
use Nwidart\Modules\Commands\RouteProviderMakeCommand;
use Nwidart\Modules\Commands\PublishTranslationCommand;
use Nwidart\Modules\Commands\PublishConfigurationCommand;
use Nwidart\Modules\Commands\RequestMakeCommand;
use Nwidart\Modules\Commands\ResourceMakeCommand;
use Nwidart\Modules\Commands\RouteProviderMakeCommand;
use Nwidart\Modules\Commands\RuleMakeCommand;
use Nwidart\Modules\Commands\SeedCommand;
use Nwidart\Modules\Commands\SeedMakeCommand;
use Nwidart\Modules\Commands\SetupCommand;
use Nwidart\Modules\Commands\TestMakeCommand;
use Nwidart\Modules\Commands\UnUseCommand;
use Nwidart\Modules\Commands\UpdateCommand;
use Nwidart\Modules\Commands\UseCommand;
use Nwidart\Modules\Commands\ComponentClassMakeCommand;
use Nwidart\Modules\Commands\ComponentViewMakeCommand;

class ConsoleServiceProvider extends ServiceProvider
{

/**
* Namespace of the console commands
*
Expand Down Expand Up @@ -129,7 +128,7 @@ private function resolveCommands()
foreach (config('modules.commands', $this->commands) as $command) {
$commands[] = Str::contains($command, $this->consoleNamespace) ?
$command :
$this->consoleNamespace . "\\";
$this->consoleNamespace . "\\";
}

return $commands;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php return '{
<?php

return '{
"Recipe": false
}';
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php return '{
<?php

return '{
"Recipe": false
}';
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php return '{
<?php

return '{
"Recipe": true
}';
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
<?php return '{
<?php

return '{
"Recipe": true
}';
49 changes: 24 additions & 25 deletions tests/Commands/ModuleMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -356,7 +356,6 @@ public function it_generes_module_with_new_provider_location()
$this->assertSame(0, $code);
}


/** @test */
public function it_generates_web_module_with_resources()
{
Expand All @@ -380,30 +379,30 @@ public function it_generates_web_module_with_resources()

$this->assertSame(0, $code);
}
/** @test */
public function it_generates_api_module_with_resources()
{
$code = $this->artisan('module:make', ['name' => ['Blog'], '--api' => true]);

$path = base_path('modules/Blog') . '/Providers/BlogServiceProvider.php';
$this->assertTrue($this->finder->exists($path));
$this->assertMatchesSnapshot($this->finder->get($path));

$path = base_path('modules/Blog') . '/Http/Controllers/BlogController.php';
$this->assertTrue($this->finder->exists($path));
$this->assertMatchesSnapshot($this->finder->get($path));

$path = base_path('modules/Blog') . '/Database/Seeders/BlogDatabaseSeeder.php';
$this->assertTrue($this->finder->exists($path));
$this->assertMatchesSnapshot($this->finder->get($path));

$path = base_path('modules/Blog') . '/Providers/RouteServiceProvider.php';
$this->assertTrue($this->finder->exists($path));
$this->assertMatchesSnapshot($this->finder->get($path));

$this->assertSame(0, $code);
}
/** @test */
/** @test */
public function it_generates_api_module_with_resources()
{
$code = $this->artisan('module:make', ['name' => ['Blog'], '--api' => true]);

$path = base_path('modules/Blog') . '/Providers/BlogServiceProvider.php';
$this->assertTrue($this->finder->exists($path));
$this->assertMatchesSnapshot($this->finder->get($path));

$path = base_path('modules/Blog') . '/Http/Controllers/BlogController.php';
$this->assertTrue($this->finder->exists($path));
$this->assertMatchesSnapshot($this->finder->get($path));

$path = base_path('modules/Blog') . '/Database/Seeders/BlogDatabaseSeeder.php';
$this->assertTrue($this->finder->exists($path));
$this->assertMatchesSnapshot($this->finder->get($path));

$path = base_path('modules/Blog') . '/Providers/RouteServiceProvider.php';
$this->assertTrue($this->finder->exists($path));
$this->assertMatchesSnapshot($this->finder->get($path));

$this->assertSame(0, $code);
}
/** @test */
public function it_generates_web_module_with_resources_when_adding_more_than_one_option()
{
$code = $this->artisan('module:make', ['name' => ['Blog'], '--api' => true,'--plain'=>true]);
Expand Down

0 comments on commit e2975f8

Please sign in to comment.