-
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #57 from davidpeach/fix/25-duplicated-local-packag…
…e-requrie Fix/25 duplicated local package requrie
- Loading branch information
Showing
6 changed files
with
103 additions
and
6 deletions.
There are no files selected for viewing
Binary file not shown.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace DavidPeach\Manuscript\Tests\Unit; | ||
|
||
use DavidPeach\Manuscript\ComposerFileManager; | ||
use DavidPeach\Manuscript\Playgrounds; | ||
use DavidPeach\Manuscript\Tests\TestCase; | ||
use Symfony\Component\Filesystem\Filesystem; | ||
use Symfony\Component\Finder\Finder; | ||
|
||
class ComposerFileManagerTest extends TestCase | ||
{ | ||
private string $root; | ||
|
||
private Filesystem $fs; | ||
|
||
/** | ||
* Clear out the "tests/test-environments" directory before each new test | ||
*/ | ||
public function setUp(): void | ||
{ | ||
$this->root = realpath(__DIR__ . '/../test-environments/composer-file-manager'); | ||
|
||
file_put_contents( | ||
$this->root . '/composer.json', | ||
file_get_contents(__DIR__ . '/../test-environments/stubs/composer.json') | ||
); | ||
|
||
$this->fs = new Filesystem; | ||
|
||
parent::setUp(); | ||
} | ||
|
||
/** @test */ | ||
public function packages_cannot_be_added_to_a_composer_require_multiple_times() | ||
{ | ||
$composer = new ComposerFileManager(); | ||
|
||
$composer->add( | ||
pathToFile: $this->root . '/composer.json', | ||
toAdd: ['repositories' => [ | ||
[ | ||
'type' => 'path', | ||
'url' => '/some/local/path', | ||
'options' => [ | ||
'symlink' => true, | ||
], | ||
] | ||
]] | ||
); | ||
|
||
$composerFileData = $composer->read($this->root . '/composer.json'); | ||
|
||
$this->assertCount(1, $composerFileData['repositories']); | ||
|
||
$this->fs->remove($this->root . '/composer.json'); | ||
} | ||
} |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,5 +10,12 @@ | |
"name": "David Peach", | ||
"email": "[email protected]" | ||
} | ||
] | ||
], | ||
"repositories": [{ | ||
"type": "path", | ||
"url": "/some/local/path", | ||
"options": { | ||
"symlink": true | ||
} | ||
}] | ||
} |