Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Mior Muhammad Zaki <[email protected]>
  • Loading branch information
crynobone committed Sep 19, 2023
1 parent 168e850 commit cb55565
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions tests/Feature/Console/MigrateMakeCommandTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,15 @@

namespace Orchestra\Canvas\Tests\Feature\Console;

use Orchestra\Canvas\Presets\Laravel;
use Orchestra\Canvas\Tests\Feature\TestCase;

class MigrateMakeCommandTest extends TestCase
{
protected $files = [
'database/acme-migrations/*.php',
];

/** @test */
public function it_can_generate_migration_file()
{
Expand Down Expand Up @@ -59,4 +64,21 @@ public function it_can_generate_migration_with_create_options_file()
'Schema::dropIfExists(\'foobar\');',
], 'foos_table.php');
}

public function testItCanGenerateMigrationFileWithCustomMigrationPath()
{
$this->instance('orchestra.canvas', new Laravel(
['namespace' => 'Acme', 'migration' => ['path' => 'database'.DIRECTORY_SEPARATOR.'acme-migrations']], $this->app->basePath()
));

$this->artisan('make:migration', ['name' => 'AcmeFoosTable', '--create' => 'foobar', '--preset' => 'canvas'])
->assertExitCode(0);

$this->assertMigrationFileContains([
'use Illuminate\Database\Migrations\Migration;',
'return new class extends Migration',
'Schema::create(\'foobar\', function (Blueprint $table) {',
'Schema::dropIfExists(\'foobar\');',
], 'acme_foos_table.php', directory: 'database/acme-migrations');
}
}

0 comments on commit cb55565

Please sign in to comment.