Skip to content

Commit

Permalink
Backup composer.json and restore it after each test case.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaspertey committed Sep 3, 2024
1 parent 1573859 commit e5f67ec
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions tests/Command/InstallTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
});

it('can initialize composer.json', function ($domainPath, $domainRoot) {
$originalContents = file_get_contents(base_path('composer.json'));

$this->updateComposer(
forget: [
['autoload', 'psr-4', 'Domains\\'],
Expand All @@ -52,8 +54,10 @@

unlink(config_path('ddd.php'));

// Reset composer back to the factory state
$this->setDomainPathInComposer('Domain', 'src/Domain', reload: true);
// Restore the original composer.json
file_put_contents(base_path('composer.json'), $originalContents);

$this->composerReload();
})->with([
['src/Domain', 'Domain'],
['src/Domains', 'Domains'],
Expand Down

0 comments on commit e5f67ec

Please sign in to comment.