2019-08-08 23:03:48 +08:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Tests;
|
|
|
|
|
2019-08-16 17:35:13 +08:00
|
|
|
use App\Services\Plugin;
|
2019-08-08 23:03:48 +08:00
|
|
|
use App\Services\PluginManager;
|
|
|
|
|
2019-08-09 10:13:55 +08:00
|
|
|
class PluginEnableCommandTest extends TestCase
|
2019-08-08 23:03:48 +08:00
|
|
|
{
|
|
|
|
public function testEnablePlugin()
|
|
|
|
{
|
|
|
|
$this->mock(PluginManager::class, function ($mock) {
|
2019-08-16 17:35:13 +08:00
|
|
|
$mock->shouldReceive('get')
|
|
|
|
->with('my-plugin')
|
|
|
|
->once()
|
|
|
|
->andReturn(new Plugin('', ['title' => 'My Plugin']));
|
2019-08-17 10:57:38 +08:00
|
|
|
$mock->shouldReceive('enable')->with('nope')->once()->andReturn(false);
|
|
|
|
$mock->shouldReceive('enable')->with('my-plugin')->once()->andReturn(true);
|
2019-08-08 23:03:48 +08:00
|
|
|
});
|
2019-08-16 17:35:13 +08:00
|
|
|
|
|
|
|
$this->artisan('plugin:enable nope')
|
|
|
|
->expectsOutput(trans('admin.plugins.operations.not-found'));
|
|
|
|
$this->artisan('plugin:enable my-plugin')
|
|
|
|
->expectsOutput(trans('admin.plugins.operations.enabled', ['plugin' => 'My Plugin']));
|
2019-08-08 23:03:48 +08:00
|
|
|
}
|
|
|
|
}
|