Skip to content

Commit 756b8db

Browse files
Migrated to phpunit10
1 parent 0722894 commit 756b8db

4 files changed

Lines changed: 17 additions & 18 deletions

File tree

.idea/deployer.flow.iml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.idea/php.xml

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

composer.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,5 +56,8 @@
5656
"composer-require-checker": "Checks for missing required composer packages",
5757
"infection": "Creates mutation tests to discover missing test coverage",
5858
"ci-all": "Runs all ci tools in sequence"
59+
},
60+
"require-dev": {
61+
"mockery/mockery": "^1.5"
5962
}
6063
}

test/command/factory/WithBinaryFromDeployerTest.php

Lines changed: 10 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,14 @@
77
use de\codenamephp\deployer\command\Command;
88
use de\codenamephp\deployer\command\runConfiguration\SimpleContainer;
99
use de\codenamephp\deployer\flow\command\factory\WithBinaryFromDeployer;
10+
use Mockery;
11+
use Mockery\Adapter\Phpunit\MockeryPHPUnitIntegration;
1012
use PHPUnit\Framework\TestCase;
1113

1214
final class WithBinaryFromDeployerTest extends TestCase {
1315

16+
use MockeryPHPUnitIntegration;
17+
1418
private WithBinaryFromDeployer $sut;
1519

1620
protected function setUp() : void {
@@ -30,15 +34,9 @@ public function test__construct() : void {
3034
public function testBuild() : void {
3135
$runConfig = new SimpleContainer(123);
3236

33-
$this->sut->deployer = $this->createMock(iGet::class);
34-
$this->sut->deployer
35-
->expects(self::exactly(2))
36-
->method('get')
37-
->withConsecutive(
38-
['flow:binary', '{{release_or_current_path}}/flow'],
39-
['flow:context', '']
40-
)
41-
->willReturnOnConsecutiveCalls('flow binary', 'flow context');
37+
$this->sut->deployer = Mockery::mock(iGet::class);
38+
$this->sut->deployer->allows('get')->once()->ordered()->with('flow:binary', '{{release_or_current_path}}/flow')->andReturn('flow binary');
39+
$this->sut->deployer->allows('get')->once()->ordered()->with('flow:context', '')->andReturn('flow context');
4240

4341
$command = $this->sut->build('flow command', ['--some', '-arg'], ['FLOW_CONTEXT' => 'some context', 'some' => 'arg'], true, $runConfig);
4442

@@ -51,15 +49,9 @@ public function testBuild() : void {
5149
}
5250

5351
public function testBuild_withMinimalArguments() : void {
54-
$this->sut->deployer = $this->createMock(iGet::class);
55-
$this->sut->deployer
56-
->expects(self::exactly(2))
57-
->method('get')
58-
->withConsecutive(
59-
['flow:binary', '{{release_or_current_path}}/flow'],
60-
['flow:context', '']
61-
)
62-
->willReturnOnConsecutiveCalls(null, null);
52+
$this->sut->deployer = Mockery::mock(iGet::class);
53+
$this->sut->deployer->allows('get')->once()->ordered()->with('flow:binary', '{{release_or_current_path}}/flow')->andReturn(null);
54+
$this->sut->deployer->allows('get')->once()->ordered()->with('flow:context', '')->andReturn(null);
6355

6456
$command = $this->sut->build('flow command');
6557

0 commit comments

Comments
 (0)