-
-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add installer step removing lockfile
Signed-off-by: Aleksei Khudiakov <aleksey@xerkus.pro>
- Loading branch information
Showing
2 changed files
with
63 additions
and
0 deletions.
There are no files selected for viewing
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,48 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace MezzioInstallerTest; | ||
|
||
use MezzioInstaller\OptionalPackages; | ||
use org\bovigo\vfs\vfsStream; | ||
use org\bovigo\vfs\vfsStreamDirectory; | ||
|
||
class RemoveLockfileTest extends OptionalPackagesTestCase | ||
{ | ||
private OptionalPackages $installer; | ||
|
||
private vfsStreamDirectory $project; | ||
|
||
/** @var string URL of project root */ | ||
private string $projectRoot; | ||
|
||
protected function setUp(): void | ||
{ | ||
parent::setUp(); | ||
$this->project = vfsStream::setup('project-root'); | ||
$this->projectRoot = vfsStream::url('project-root'); | ||
$this->installer = $this->createOptionalPackages($this->projectRoot); | ||
} | ||
|
||
public function testRemovesLockfileWhenInvoked(): void | ||
{ | ||
vfsStream::newFile('composer.lock')->at($this->project)->withContent('{}'); | ||
$this->io | ||
->expects($this->once()) | ||
->method('write') | ||
->with($this->stringContains('Removing composer.lock')); | ||
$this->installer->removeLockfile(); | ||
|
||
self::assertFalse($this->project->hasChild('composer.lock'), 'Lockfile was not deleted'); | ||
} | ||
|
||
public function testNoopWhenNoLockfileExists(): void | ||
{ | ||
self::assertFalse($this->project->hasChild('composer.lock')); | ||
$this->io | ||
->expects($this->never()) | ||
->method('write'); | ||
$this->installer->removeLockfile(); | ||
} | ||
} |