Skip to content

Commit

Permalink
Test that it validates package/composer.json before exporting any f…
Browse files Browse the repository at this point in the history
…iles.
  • Loading branch information
jesseleite committed Nov 12, 2024
1 parent ee450c4 commit b3a973f
Showing 1 changed file with 23 additions and 0 deletions.
23 changes: 23 additions & 0 deletions tests/StarterKits/ExportTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -638,6 +638,29 @@ public function it_uses_existing_composer_json_file()
, $this->files->get($this->exportPath('composer.json')));
}

#[Test]
public function it_requires_composer_json_file_in_package_folder_if_it_exists()
{
$this->files->makeDirectory(base_path('package/src'), 0777, true, true);
$this->files->put(base_path('package/src/ServiceProvider.php'), 'I am a service provider!');
// $this->files->put(base_path('package/composer.json'), 'I am a composer.json!'); // Say we forget to create a composer.json file

$this->setExportPaths([
'config',
]);

$this->assertFileDoesNotExist($this->exportPath('config'));
$this->assertFileDoesNotExist($this->exportPath('src'));

$this
->exportCoolRunnings()
// ->expectsOutput('Package config [package/composer.json] does not exist.') // TODO: Why does this work in InstallTest?
->assertFailed();

$this->assertFileDoesNotExist($this->exportPath('config'));
$this->assertFileDoesNotExist($this->exportPath('src'));
}

#[Test]
public function it_exports_whole_package_folder_instead_of_composer_json_file_if_it_exists()
{
Expand Down

0 comments on commit b3a973f

Please sign in to comment.