-
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Various udpates and more tests (#235)
- Loading branch information
1 parent
775dae5
commit 51dc3e0
Showing
47 changed files
with
880 additions
and
416 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
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
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
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
49 changes: 49 additions & 0 deletions
49
src/SonsOfPHP/Bard/Tests/Operation/Bard/UpdateVersionOperationTest.php
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,49 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace SonsOfPHP\Bard\Tests\Operation\Bard; | ||
|
||
use PHPUnit\Framework\Attributes\CoversClass; | ||
use PHPUnit\Framework\Attributes\Group; | ||
use PHPUnit\Framework\MockObject\MockObject; | ||
use PHPUnit\Framework\TestCase; | ||
use SonsOfPHP\Bard\JsonFileInterface; | ||
use SonsOfPHP\Bard\Operation\Bard\UpdateVersionOperation; | ||
use SonsOfPHP\Bard\Operation\OperationInterface; | ||
use SonsOfPHP\Component\Version\VersionInterface; | ||
|
||
#[Group('bard')] | ||
#[CoversClass(UpdateVersionOperation::class)] | ||
final class UpdateVersionOperationTest extends TestCase | ||
{ | ||
private UpdateVersionOperation $worker; | ||
|
||
private JsonFileInterface&MockObject $jsonFile; | ||
|
||
private VersionInterface&MockObject $version; | ||
|
||
protected function setUp(): void | ||
{ | ||
$this->version = $this->createMock(VersionInterface::class); | ||
$this->worker = new UpdateVersionOperation($this->version); | ||
|
||
$this->jsonFile = $this->createMock(JsonFileInterface::class); | ||
} | ||
|
||
public function testItImplementsCorrectInterface(): void | ||
{ | ||
$this->assertInstanceOf(OperationInterface::class, $this->worker); | ||
} | ||
|
||
public function testItWillUpdateVersionSection(): void | ||
{ | ||
$this->version->method('toString')->willReturn('1.2.3'); | ||
$this->jsonFile->expects($this->once())->method('setSection')->with( | ||
'version', | ||
$this->callback(fn($version): true => '1.2.3' === $version) | ||
); | ||
|
||
$this->worker->apply($this->jsonFile); | ||
} | ||
} |
Oops, something went wrong.