Skip to content

Commit

Permalink
Fixed empty directory creation (#80)
Browse files Browse the repository at this point in the history
* Fixed empty directory creation

* Code style

---------

Co-authored-by: Chris Morrell <[email protected]>
  • Loading branch information
Wulfheart and inxilpro authored Apr 3, 2024
1 parent c4d2e96 commit e13026c
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 4 deletions.
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'));
}
}

0 comments on commit e13026c

Please sign in to comment.