-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from ARCANESOFT/develop
Adding publish commands
- Loading branch information
Showing
5 changed files
with
188 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
<?php namespace Arcanesoft\Media\Console; | ||
|
||
use Arcanedev\Support\Bases\Command as BaseCommand; | ||
|
||
/** | ||
* Class Command | ||
* | ||
* @package Arcanesoft\Media\Console | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
abstract class Command extends BaseCommand | ||
{ | ||
// | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
<?php namespace Arcanesoft\Media\Console; | ||
|
||
use Arcanesoft\Media\MediaServiceProvider; | ||
|
||
/** | ||
* Class PublishCommand | ||
* | ||
* @package Arcanesoft\Media\Console | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
class PublishCommand extends Command | ||
{ | ||
/* ------------------------------------------------------------------------------------------------ | ||
| Properties | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
/** | ||
* The name and signature of the console command. | ||
* | ||
* @var string | ||
*/ | ||
protected $signature = 'media:publish'; | ||
|
||
/** | ||
* The console command description. | ||
* | ||
* @var string | ||
*/ | ||
protected $description = 'Publish media config, assets and other stuff.'; | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
| Main Functions | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
/** | ||
* Execute the console command. | ||
*/ | ||
public function handle() | ||
{ | ||
$this->call('vendor:publish', [ | ||
'--provider' => MediaServiceProvider::class, | ||
]); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,48 @@ | ||
<?php namespace Arcanesoft\Media\Providers; | ||
|
||
use Arcanedev\Support\ServiceProvider; | ||
use Arcanesoft\Media\Console; | ||
|
||
/** | ||
* Class CommandServiceProvider | ||
* | ||
* @package Arcanesoft\Media\Providers | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
class CommandServiceProvider extends ServiceProvider | ||
{ | ||
/* ------------------------------------------------------------------------------------------------ | ||
| Properties | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
/** | ||
* Console commands. | ||
* | ||
* @var array | ||
*/ | ||
protected $commands = [ | ||
Console\PublishCommand::class, | ||
]; | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
| Main Functions | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
/** | ||
* Register the service provider. | ||
*/ | ||
public function register() | ||
{ | ||
$this->commands($this->commands); | ||
} | ||
|
||
/** | ||
* Get the provided commands. | ||
* | ||
* @return array | ||
*/ | ||
public function provides() | ||
{ | ||
return $this->commands; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
<?php namespace Arcanesoft\Media\Tests\Providers; | ||
|
||
use Arcanesoft\Media\Tests\TestCase; | ||
|
||
/** | ||
* Class CommandServiceProviderTest | ||
* | ||
* @package Arcanesoft\Media\Tests\Providers | ||
* @author ARCANEDEV <[email protected]> | ||
*/ | ||
class CommandServiceProviderTest extends TestCase | ||
{ | ||
/* ------------------------------------------------------------------------------------------------ | ||
| Properties | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
/** @var \Arcanesoft\Media\Providers\CommandServiceProvider */ | ||
private $provider; | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
| Main Functions | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
public function setUp() | ||
{ | ||
parent::setUp(); | ||
|
||
$this->provider = $this->app->getProvider(\Arcanesoft\Media\Providers\CommandServiceProvider::class); | ||
} | ||
|
||
public function tearDown() | ||
{ | ||
unset($this->provider); | ||
|
||
parent::tearDown(); | ||
} | ||
|
||
/* ------------------------------------------------------------------------------------------------ | ||
| Test Functions | ||
| ------------------------------------------------------------------------------------------------ | ||
*/ | ||
/** @test */ | ||
public function it_can_be_instantiated() | ||
{ | ||
$expectations = [ | ||
\Illuminate\Support\ServiceProvider::class, | ||
\Arcanedev\Support\ServiceProvider::class, | ||
\Arcanesoft\Media\Providers\CommandServiceProvider::class, | ||
]; | ||
|
||
foreach ($expectations as $expected) { | ||
$this->assertInstanceOf($expected, $this->provider); | ||
} | ||
} | ||
|
||
/** @test */ | ||
public function it_can_provides() | ||
{ | ||
$expected = [ | ||
\Arcanesoft\Media\Console\PublishCommand::class, | ||
]; | ||
|
||
$this->assertSame($expected, $this->provider->provides()); | ||
} | ||
} |