Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed empty directory creation #80

Merged
merged 4 commits into from
Apr 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/Console/Commands/Make/MakeModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,13 +94,13 @@ public function handle()
$this->setUpStyles();

$this->newLine();

$this->ensureModulesDirectoryExists();


if ($this->shouldAbortToPublishConfig()) {
return 0;
}


$this->ensureModulesDirectoryExists();

$this->writeStubs();
$this->updateCoreComposerConfig();

Expand Down
13 changes: 13 additions & 0 deletions tests/Commands/Make/MakeModuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,17 @@ public function test_it_prompts_on_first_module_if_no_custom_namespace_is_set():

$this->assertTrue($fs->isDirectory($this->getBasePath().'/app-modules/test-module-two'));
}

public function test_it_does_not_create_an_empty_directory_if_prompt_on_first_module_if_no_custom_namespace_is_set_is_rejected(): void
{
$fs = $this->filesystem();

$this->artisan(MakeModule::class, ['name' => 'test-module'])
->expectsQuestion('Would you like to cancel and configure your module namespace first?', true)
->assertExitCode(0);

Modules::reload();

$this->assertFalse($fs->isDirectory($this->getBasePath().'/app-modules/test-module'));
}
}
Loading