Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
asbiin committed Jul 28, 2023
1 parent 2146357 commit 067c22b
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 3 deletions.
7 changes: 5 additions & 2 deletions app/Console/Commands/SetupApplication.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ class SetupApplication extends Command
*/
protected $signature = 'monica:setup
{--force : Force the operation to run when in production.}
{--skip-storage-link : Skip storage link create.}';
{--skip-storage-link : Skip storage link create.}
{--skip-docs : Skip api docs generation.}';

/**
* The console command description.
Expand All @@ -40,7 +41,9 @@ public function handle(): void
$this->clearConfig();
$this->symlink();
$this->migrate();
$this->documentation();
if ($this->option('skip-docs') !== true) {
$this->documentation();
}
$this->cacheConfig();
$this->scout();
}
Expand Down
7 changes: 6 additions & 1 deletion tests/Unit/Commands/SetupCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,19 @@

namespace Tests\Unit\Commands;

use Illuminate\Foundation\Testing\DatabaseTransactions;
use PHPUnit\Framework\Attributes\RunClassInSeparateProcess;
use Tests\TestCase;

#[RunClassInSeparateProcess]
class SetupCommandTest extends TestCase
{
use DatabaseTransactions;

/** @test */
public function it_run_setup_command(): void
{
$this->artisan('monica:setup')
$this->artisan('monica:setup', ['--skip-docs' => true])
->expectsOutput('✓ Resetting application cache')
->expectsOutput('✓ Clear config cache')
->expectsOutput('✓ Clear route cache')
Expand Down
21 changes: 21 additions & 0 deletions tests/Unit/Commands/SetupDocumentationTest.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

namespace Tests\Unit\Commands;

use Illuminate\Foundation\Testing\DatabaseTransactions;
use PHPUnit\Framework\Attributes\RunClassInSeparateProcess;
use PHPUnit\Framework\Attributes\Test;
use Tests\TestCase;

#[RunClassInSeparateProcess]
class SetupDocumentationTest extends TestCase
{
use DatabaseTransactions;

#[Test]
public function it_run_scribe_setup(): void
{
$this->artisan('scribe:setup', ['--clean' => true, '--force' => true, '-q' => true])
->assertExitCode(0);
}
}

0 comments on commit 067c22b

Please sign in to comment.