Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  add support for immutable 5
  use blackbox 5
  use psalm 5
  test against php 8.3
  • Loading branch information
Baptouuuu committed Sep 17, 2023
2 parents ff58c5f + a54cf4d commit fed3a31
Show file tree
Hide file tree
Showing 12 changed files with 252 additions and 142 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ 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:
Expand All @@ -35,7 +35,7 @@ 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:
Expand All @@ -56,7 +56,7 @@ jobs:
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
Expand Up @@ -2,3 +2,4 @@ composer.lock
vendor
.phpunit.result.cache
test.log
.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

## 5.1.0 - 2023-09-16

### Added

- Support for `innmind/immutable:~5.0`

### Removed

- Support for PHP `8.1`

## 5.0.0 - 2023-01-29

### Added
Expand Down
12 changes: 6 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@
"issues": "http://github.com/Innmind/ServerControl/issues"
},
"require": {
"php": "~8.1",
"innmind/immutable": "^4.1.1",
"php": "~8.2",
"innmind/immutable": "~4.15|~5.0",
"innmind/stream": "~4.0",
"innmind/url": "~4.0",
"psr/log": "~3.0",
"innmind/time-continuum": "^3.1",
"innmind/time-continuum": "^3.1,<3.3|^3.4.1",
"innmind/filesystem": "~6.2",
"innmind/time-warp": "^3.0"
},
Expand All @@ -34,9 +34,9 @@
}
},
"require-dev": {
"phpunit/phpunit": "^9.5.13",
"vimeo/psalm": "~4.17",
"innmind/black-box": "^4.17",
"phpunit/phpunit": "~10.2",
"vimeo/psalm": "~5.12",
"innmind/black-box": "~5.5",
"innmind/coding-standard": "~2.0"
}
}
21 changes: 13 additions & 8 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,6 +1,16 @@
<?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>
Expand All @@ -9,10 +19,5 @@
<directory>./vendor</directory>
<directory>./fixtures</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
6 changes: 2 additions & 4 deletions src/Server/Process/Started.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ public function output(bool $keepOutputWhileWriting = true): \Generator
*/
private function status(): array
{
/** @var Status */
return \proc_get_status($this->process);
}

Expand Down Expand Up @@ -267,14 +268,11 @@ private function writeAndRead(
bool $keepOutputWhileWriting,
): array {
[$watch, $output, $stream] = $chunks
->map(static fn($chunk) => $chunk->toEncoding('ASCII'))
->map(static fn($chunk) => $chunk->toEncoding(Str\Encoding::ascii))
->reduce(
[$watch, $output, $stream],
function($state, $chunk) use ($keepOutputWhileWriting) {
/**
* @var Watch $watch
* @var Sequence<array{0: Str, 1: Type}> $output
* @var Writable $stream
* @psalm-suppress MixedAssignment
* @psalm-suppress MixedArrayAccess
*/
Expand Down
2 changes: 1 addition & 1 deletion tests/Server/Command/StrTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ public function testInterface(string $str, string $expected)
$this->assertSame($expected, (new Str($str))->toString());
}

public function cases(): array
public static function cases(): array
{
return [
['a"b%c%', "'a\"b%c%'"],
Expand Down
33 changes: 21 additions & 12 deletions tests/Server/ScriptTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,13 +34,16 @@ public function testInvokation()
->willReturn($processes = $this->createMock(Processes::class));
$process = $this->createMock(Process::class);
$processes
->expects($this->exactly(2))
->expects($matcher = $this->exactly(2))
->method('execute')
->withConsecutive(
[$command1],
[$command2],
)
->willReturn($process);
->willReturnCallback(function($command) use ($matcher, $command1, $command2, $process) {
match ($matcher->numberOfInvocations()) {
1 => $this->assertSame($command1, $command),
2 => $this->assertSame($command2, $command),
};

return $process;
});
$process
->expects($this->any())
->method('wait')
Expand Down Expand Up @@ -81,13 +84,19 @@ public function testThrowOnFailure()
$this->createMock(Output::class),
)));
$processes
->expects($this->exactly(2))
->expects($matcher = $this->exactly(2))
->method('execute')
->withConsecutive(
[$command1],
[$command2],
)
->will($this->onConsecutiveCalls($process1, $process2));
->willReturnCallback(function($command) use ($matcher, $command1, $command2, $process1, $process2) {
match ($matcher->numberOfInvocations()) {
1 => $this->assertSame($command1, $command),
2 => $this->assertSame($command2, $command),
};

return match ($matcher->numberOfInvocations()) {
1 => $process1,
2 => $process2,
};
});

$e = $script($server)->match(
static fn() => null,
Expand Down
Loading

0 comments on commit fed3a31

Please sign in to comment.