Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
* develop:
  specify next release
  fix tests
  test against lowest dependencies
  add support for immutable 5
  use blackbox 5
  use psalm 5
  fix psalm error
  test against php 8.3
  • Loading branch information
Baptouuuu committed Sep 23, 2023
2 parents b27fb11 + d71cdc8 commit 229f9c5
Show file tree
Hide file tree
Showing 9 changed files with 91 additions and 38 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 @@ -21,6 +22,8 @@ jobs:
coverage: xdebug
- name: Composer
uses: "ramsey/composer-install@v2"
with:
dependency-versions: ${{ matrix.dependencies }}
- name: Install S3 server
run: cd tests && npm ci
- name: PHPUnit
Expand All @@ -32,7 +35,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 @@ -44,13 +48,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
Expand Up @@ -4,3 +4,4 @@ vendor/
tests/node_modules
!fixtures/.gitkeep
fixtures/*
.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.2.0 - 2023-09-23

### Added

- Support for `innmind/immutable:~5.0`

### Removed

- Support for PHP `8.1`

## 3.1.0 - 2023-01-29

### Added
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@
"issues": "http://github.com/Innmind/S3/issues"
},
"require": {
"php": "~8.1",
"php": "~8.2",
"innmind/url": "~4.1",
"innmind/immutable": "~4.9",
"innmind/immutable": "~4.9|~5.0",
"innmind/http": "~5.3|~6.0",
"innmind/filesystem": "~6.1",
"innmind/http-transport": "^6.2.1",
Expand All @@ -37,9 +37,9 @@
}
},
"require-dev": {
"phpunit/phpunit": "~9.0",
"vimeo/psalm": "~4.4",
"innmind/black-box": "^4.17",
"phpunit/phpunit": "~10.2",
"vimeo/psalm": "~5.15",
"innmind/black-box": "~5.5",
"innmind/coding-standard": "~2.0",
"symfony/filesystem": "~6.2",
"symfony/process": "~6.2"
Expand Down
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
2 changes: 1 addition & 1 deletion src/Filesystem/Adapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ public function root(): Directory
private function upload(Path $root, File $file): void
{
if ($file instanceof Directory) {
$file->foreach(
$_ = $file->foreach(
fn(File $subFile) => $this->upload($this->resolve($root, $file), $subFile),
);

Expand Down
15 changes: 15 additions & 0 deletions tests/Bucket/OverHttpTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -158,10 +158,16 @@ public function testListFilesInADirectory()
$this->bucket->upload(
Path::of('l1/l2/file1.txt'),
Content\Lines::ofContent($content1),
)->match(
static fn() => null,
static fn() => null,
);
$this->bucket->upload(
Path::of('l1/file2.txt'),
Content\Lines::ofContent($content2),
)->match(
static fn() => null,
static fn() => null,
);

$this->assertSame(
Expand Down Expand Up @@ -196,10 +202,16 @@ public function testListFilesInRootDirectory()
$this->bucket->upload(
Path::of('l1/l2/file1.txt'),
Content\Lines::ofContent($content1),
)->match(
static fn() => null,
static fn() => null,
);
$this->bucket->upload(
Path::of('l1/file2.txt'),
Content\Lines::ofContent($content2),
)->match(
static fn() => null,
static fn() => null,
);

$this->assertSame(
Expand Down Expand Up @@ -238,6 +250,9 @@ public function testContainsDirectory()
$this->bucket->upload(
Path::of('l1/l2/file1.txt'),
Content\Lines::ofContent($content),
)->match(
static fn() => null,
static fn() => null,
);

$this->assertTrue($this->bucket->contains(Path::of('l1/')));
Expand Down
56 changes: 35 additions & 21 deletions tests/Filesystem/AdapterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,13 +67,21 @@ public function testAddDirectory()
$content1 = $this->createMock(Content::class);
$content2 = $this->createMock(Content::class);
$bucket
->expects($this->exactly(2))
->expects($matcher = $this->exactly(2))
->method('upload')
->withConsecutive(
[Path::of('dir/sub/foo.pdf'), $content1],
[Path::of('dir/sub/bar.pdf'), $content2],
)
->willReturn(Maybe::just(new SideEffect));

->willReturnCallback(function($path, $content) use ($matcher, $content1, $content2) {
match ($matcher->numberOfInvocations()) {
1 => $this->assertEquals(Path::of('dir/sub/foo.pdf'), $path),
2 => $this->assertEquals(Path::of('dir/sub/bar.pdf'), $path),
};
match ($matcher->numberOfInvocations()) {
1 => $this->assertSame($content1, $content),
2 => $this->assertSame($content2, $content),
};

return Maybe::just(new SideEffect);
});

$this->assertNull(
$filesystem->add(Directory::named('dir')->add(
Expand Down Expand Up @@ -143,16 +151,19 @@ public function testGetDirectory()
->with(Path::of('foo/'))
->willReturn(true);
$bucket
->expects($this->exactly(2))
->expects($matcher = $this->exactly(2))
->method('list')
->withConsecutive(
[Path::of('foo/')],
[Path::of('foo/bar/')],
)
->will($this->onConsecutiveCalls(
Sequence::of(Path::of('bar/')),
Sequence::of(Path::of('baz.txt')),
));
->willReturnCallback(function($path) use ($matcher) {
match ($matcher->numberOfInvocations()) {
1 => $this->assertEquals(Path::of('foo/'), $path),
2 => $this->assertEquals(Path::of('foo/bar/'), $path),
};

return match ($matcher->numberOfInvocations()) {
1 => Sequence::of(Path::of('bar/')),
2 => Sequence::of(Path::of('baz.txt')),
};
});
$bucket
->expects($this->once())
->method('get')
Expand Down Expand Up @@ -227,13 +238,16 @@ public function testFilesListOfFilesystemAlwaysEmpty()
->with(Path::none())
->willReturn(Sequence::of(Path::of('foo'), Path::of('bar')));
$bucket
->expects($this->exactly(2))
->expects($matcher = $this->exactly(2))
->method('get')
->withConsecutive([Path::of('foo')], [Path::of('bar')])
->willReturnOnConsecutiveCalls(
Maybe::just($this->createMock(Content::class)),
Maybe::just($this->createMock(Content::class)),
);
->willReturnCallback(function($path) use ($matcher) {
match ($matcher->numberOfInvocations()) {
1 => $this->assertEquals(Path::of('foo'), $path),
2 => $this->assertEquals(Path::of('bar'), $path),
};

return Maybe::just($this->createMock(Content::class));
});

$files = $filesystem->all();

Expand Down

0 comments on commit 229f9c5

Please sign in to comment.