Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  fix minimum version of innmind/cli
  add support for immutable 5
  use blackbox 5
  use psalm 5
  test against lowest dependencies
  test against php 8.3
  • Loading branch information
Baptouuuu committed Sep 24, 2023
2 parents 6a80942 + 91aef22 commit c68e845
Show file tree
Hide file tree
Showing 10 changed files with 444 additions and 262 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@ jobs:
strategy:
matrix:
os: [ubuntu-latest, macOS-latest]
php-version: ['8.1', '8.2']
php-version: ['8.2', '8.3']
dependencies: ['lowest', 'highest']
name: 'PHPUnit'
steps:
- name: Checkout
Expand All @@ -22,6 +23,8 @@ jobs:
ini-values: xdebug.max_nesting_level=2048
- name: Composer
uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: PHPUnit
run: vendor/bin/phpunit --coverage-clover=coverage.clover
- uses: codecov/codecov-action@v1
Expand All @@ -31,7 +34,8 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.1', '8.2']
php-version: ['8.2', '8.3']
dependencies: ['lowest', 'highest']
name: 'Psalm'
steps:
- name: Checkout
Expand All @@ -43,13 +47,15 @@ jobs:
extensions: mbstring, intl
- name: Composer
uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: Psalm
run: vendor/bin/psalm --shepherd
cs:
runs-on: ubuntu-latest
strategy:
matrix:
php-version: ['8.1']
php-version: ['8.2']
name: 'CS'
steps:
- name: Checkout
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/composer.lock
/vendor
.phpunit.result.cache
.phpunit.cache
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,15 @@
# Changelog

## 3.7.0 - 2023-09-24

### Added

- Support for `innmind/immutable:~5.0`

### Removed

- Support for PHP `8.1`

## 3.6.0 - 2023-09-02

### Added
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,15 @@
"issues": "http://github.com/Innmind/LabStation/issues"
},
"require": {
"php": "~8.1",
"php": "~8.2",
"innmind/url": "~4.0",
"innmind/cli": "~3.0",
"innmind/cli": "~3.4",
"innmind/operating-system": "~3.1",
"innmind/json": "^1.1",
"innmind/ipc": "~4.0",
"innmind/process-manager": "~4.0",
"innmind/server-control": "~4.2|~5.0",
"innmind/immutable": "~4.4"
"innmind/immutable": "~4.4|~5.0"
},
"autoload": {
"psr-4": {
Expand All @@ -37,9 +37,9 @@
}
},
"require-dev": {
"phpunit/phpunit": "~9.0",
"vimeo/psalm": "^4.1",
"innmind/black-box": "^4.9",
"phpunit/phpunit": "~10.2",
"vimeo/psalm": "~5.15",
"innmind/black-box": "~5.5",
"innmind/coding-standard": "~2.0"
},
"bin": ["lab-station"]
Expand Down
21 changes: 13 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,17 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" printerClass="Innmind\BlackBox\PHPUnit\ResultPrinterV9" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd">
<coverage>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" colors="true" bootstrap="vendor/autoload.php" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd" cacheDirectory=".phpunit.cache">
<extensions>
<bootstrap class="Innmind\BlackBox\PHPUnit\Extension">
</bootstrap>
</extensions>
<coverage/>
<testsuites>
<testsuite name="Test suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
<source>
<include>
<directory>.</directory>
</include>
<exclude>
<directory>./tests</directory>
<directory>./vendor</directory>
</exclude>
</coverage>
<testsuites>
<testsuite name="Test suite">
<directory>./tests</directory>
</testsuite>
</testsuites>
</source>
</phpunit>
2 changes: 2 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
<psalm
errorLevel="1"
resolveFromConfigFile="true"
findUnusedCode="false"
findUnusedBaselineEntry="true"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
Expand Down
132 changes: 81 additions & 51 deletions tests/Trigger/BlackBoxTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -155,25 +155,35 @@ public function testTriggerTestsSuiteWhenActivity()
->expects($this->once())
->method('mount')
->willReturn($adapter);
$tests = $this->createMock(Process::class);
$say = $this->createMock(Process::class);
$processes
->expects($this->exactly(2))
->expects($matcher = $this->exactly(2))
->method('execute')
->withConsecutive(
[$this->callback(static function($command): bool {
return $command->toString() === "php 'blackbox.php'" &&
'/somewhere/' === $command->workingDirectory()->match(
static fn($path) => $path->toString(),
static fn() => null,
);
})],
[$this->callback(static function($command): bool {
return $command->toString() === "say 'BlackBox : ok'";
})],
)
->will($this->onConsecutiveCalls(
$tests = $this->createMock(Process::class),
$say = $this->createMock(Process::class),
));
->willReturnCallback(function($command) use ($matcher, $tests, $say) {
match ($matcher->numberOfInvocations()) {
1 => $this->assertSame(
"php 'blackbox.php'",
$command->toString(),
),
2 => $this->assertSame(
"say 'BlackBox : ok'",
$command->toString(),
),
};

if ($matcher->numberOfInvocations() === 1) {
$this->assertSame('/somewhere/', $command->workingDirectory()->match(
static fn($path) => $path->toString(),
static fn() => null,
));
}

return match ($matcher->numberOfInvocations()) {
1 => $tests,
2 => $say,
};
});
$tests
->expects($this->once())
->method('output')
Expand Down Expand Up @@ -291,25 +301,35 @@ public function testDoesntClearTerminalOnSuccessfullTestWhenSpecifiedOptionProvi
->expects($this->once())
->method('mount')
->willReturn($adapter);
$tests = $this->createMock(Process::class);
$say = $this->createMock(Process::class);
$processes
->expects($this->exactly(2))
->expects($matcher = $this->exactly(2))
->method('execute')
->withConsecutive(
[$this->callback(static function($command): bool {
return $command->toString() === "php 'blackbox.php'" &&
'/somewhere/' === $command->workingDirectory()->match(
static fn($path) => $path->toString(),
static fn() => null,
);
})],
[$this->callback(static function($command): bool {
return $command->toString() === "say 'BlackBox : ok'";
})],
)
->will($this->onConsecutiveCalls(
$tests = $this->createMock(Process::class),
$say = $this->createMock(Process::class),
));
->willReturnCallback(function($command) use ($matcher, $tests, $say) {
match ($matcher->numberOfInvocations()) {
1 => $this->assertSame(
"php 'blackbox.php'",
$command->toString(),
),
2 => $this->assertSame(
"say 'BlackBox : ok'",
$command->toString(),
),
};

if ($matcher->numberOfInvocations() === 1) {
$this->assertSame('/somewhere/', $command->workingDirectory()->match(
static fn($path) => $path->toString(),
static fn() => null,
));
}

return match ($matcher->numberOfInvocations()) {
1 => $tests,
2 => $say,
};
});
$tests
->expects($this->once())
->method('wait')
Expand Down Expand Up @@ -360,25 +380,35 @@ public function testSaidMessageIsChangedWhenTestsAreFailing()
->expects($this->once())
->method('mount')
->willReturn($adapter);
$tests = $this->createMock(Process::class);
$say = $this->createMock(Process::class);
$processes
->expects($this->exactly(2))
->expects($matcher = $this->exactly(2))
->method('execute')
->withConsecutive(
[$this->callback(static function($command): bool {
return $command->toString() === "php 'blackbox.php'" &&
'/somewhere/' === $command->workingDirectory()->match(
static fn($path) => $path->toString(),
static fn() => null,
);
})],
[$this->callback(static function($command): bool {
return $command->toString() === "say 'BlackBox : failing'";
})],
)
->will($this->onConsecutiveCalls(
$tests = $this->createMock(Process::class),
$say = $this->createMock(Process::class),
));
->willReturnCallback(function($command) use ($matcher, $tests, $say) {
match ($matcher->numberOfInvocations()) {
1 => $this->assertSame(
"php 'blackbox.php'",
$command->toString(),
),
2 => $this->assertSame(
"say 'BlackBox : failing'",
$command->toString(),
),
};

if ($matcher->numberOfInvocations() === 1) {
$this->assertSame('/somewhere/', $command->workingDirectory()->match(
static fn($path) => $path->toString(),
static fn() => null,
));
}

return match ($matcher->numberOfInvocations()) {
1 => $tests,
2 => $say,
};
});
$tests
->expects($this->once())
->method('output')
Expand Down
Loading

0 comments on commit c68e845

Please sign in to comment.