Skip to content

Commit

Permalink
More internal updates due to API changes, Fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
theseer committed May 17, 2020
1 parent cd99bb0 commit 6a47e4b
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 6 deletions.
1 change: 1 addition & 0 deletions src/services/migration/ProjectPhiveXmlMigration.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ public function getDescription(): string {
}

protected function doMigrate(Filename $legacy, Filename $new): void {
$new->getDirectory()->ensureExists();
$new->putContent($legacy->read()->getContent());
}

Expand Down
6 changes: 3 additions & 3 deletions src/shared/Git.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public function __construct(Directory $workingDirectory) {
}

public function isRepository(Directory $directory): bool {
return \is_dir($directory . '/.git');
return \is_dir($directory->asString() . '/.git');
}

/**
Expand All @@ -25,9 +25,9 @@ public function getMostRecentTag(Directory $directory): string {
if (!$this->isRepository($directory)) {
throw new GitException(\sprintf('%s is not a git repository', $directory->asString()));
}
\chdir($directory->__toString());
\chdir($directory->asString());
$tag = @\exec('git describe --tags --always --dirty 2>' . $this->getDevNull(), $output, $returnCode);
\chdir($this->workingDirectory->__toString());
\chdir($this->workingDirectory->asString());

if ($returnCode !== 0) {
throw new GitException('Could not determine most recent tag');
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/shared/ComposerAliasTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public function testThrowsExceptionIfAliasStartsWithASlash(): void {

public function testToString(): void {
$alias = new ComposerAlias('some/alias');
$this->assertSame('some/alias', $alias->__toString());
$this->assertSame('some/alias', $alias->asString());
}

public function testGetVendorReturnsExpectedValue(): void {
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/shared/PharRegistryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ public function testReturnsExpectedUsedPharsByDestination(): void {

/** @var Directory|\PHPUnit_Framework_MockObject_MockObject $destination */
$destination = $this->createMock(Directory::class);
$destination->method('__toString')
$destination->method('asString')
->willReturn('/vagrant/phive/tools');

$expected = [
Expand Down
2 changes: 1 addition & 1 deletion tests/unit/shared/environment/UnixoidEnvironmentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function getProxyProvider() {

public function testGetHomeDirectory(): void {
$env = new UnixoidEnvironment(['HOME' => __DIR__], $this->getExecutorMock());
$this->assertSame(__DIR__, (string)$env->getHomeDirectory());
$this->assertSame(__DIR__, $env->getHomeDirectory()->asString());
}

public function testGetProxyThrowsExceptionIfProxyIsNotSet(): void {
Expand Down

0 comments on commit 6a47e4b

Please sign in to comment.