diff --git a/app/Console/Commands/OptionsCacheCommand.php b/app/Console/Commands/OptionsCacheCommand.php index 32c56b7a..66213474 100644 --- a/app/Console/Commands/OptionsCacheCommand.php +++ b/app/Console/Commands/OptionsCacheCommand.php @@ -12,25 +12,11 @@ class OptionsCacheCommand extends Command protected $description = 'Cache Blessing Skin options'; - /** @var Filesystem */ - protected $filesystem; - - /** @var Option */ - protected $options; - - public function __construct(Filesystem $filesystem, Option $options) + public function handle(Filesystem $filesystem, Option $options) { - parent::__construct(); - - $this->filesystem = $filesystem; - $this->options = $options; - } - - public function handle() - { - $content = var_export($this->options->all(), true); + $content = var_export($options->all(), true); $content = 'filesystem->put(storage_path('options/cache.php'), $content); + $filesystem->put(storage_path('options/cache.php'), $content); $this->info('Options cached successfully.'); } } diff --git a/tests/CommandsTest/OptionsCacheCommandTest.php b/tests/CommandsTest/OptionsCacheCommandTest.php index 58302616..a1757cdf 100644 --- a/tests/CommandsTest/OptionsCacheCommandTest.php +++ b/tests/CommandsTest/OptionsCacheCommandTest.php @@ -9,16 +9,17 @@ class OptionsCacheCommandTest extends TestCase { public function testRun() { - /*$this->mock(Filesystem::class, function ($mock) { + $this->mock(Filesystem::class, function ($mock) { $mock->shouldReceive('put') - /*->withArgs(function ($path, $content) { + ->withArgs(function ($path, $content) { $this->assertEquals(storage_path('options/cache.php'), $path); - $this->assertTrue(Str::startsWith($content), 'assertTrue(Str::startsWith($content, 'assertTrue(Str::endsWith($content, ';')); return true; }) ->once(); - });*/ + }); $this->artisan('options:cache')->expectsOutput('Options cached successfully.'); }