Skip to content

Commit f846848

Browse files
committed
use blackbox 7
1 parent 7017f2c commit f846848

22 files changed

Lines changed: 218 additions & 180 deletions

CHANGELOG.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,11 @@
11
# Changelog
22

3+
## [Unreleased]
4+
5+
### Changed
6+
7+
- Requires `innmind/black-box:~7.0`
8+
39
## 9.0.0 - 2026-01-25
410

511
### Added

blackbox.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,7 @@
2525
__DIR__.'/proofs/',
2626
__DIR__.'/fixtures/',
2727
)
28-
->dumpTo('coverage.clover')
29-
->enableWhen(true),
28+
->dumpTo('coverage.clover'),
3029
)
3130
->scenariiPerProof(1),
3231
)

composer.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,18 +37,18 @@
3737
},
3838
"require-dev": {
3939
"innmind/static-analysis": "~1.3",
40-
"innmind/black-box": "~6.5",
40+
"innmind/black-box": "~7.0",
4141
"innmind/coding-standard": "~2.0",
4242
"symfony/filesystem": "~6.0|~7.0|~8.0",
4343
"ramsey/uuid": "^4.6"
4444
},
4545
"conflict": {
46-
"innmind/black-box": "<6.0|~7.0"
46+
"innmind/black-box": "<7.0|~8.0"
4747
},
4848
"suggest": {
4949
"innmind/black-box": "For property based testing"
5050
},
5151
"provide": {
52-
"innmind/black-box-sets": "6.0"
52+
"innmind/black-box-sets": "7.0"
5353
}
5454
}

fixtures/File.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,6 @@ public static function any(): Set
2323
Name::any(),
2424
Set::strings(),
2525
MediaType::any(),
26-
)->toSet();
26+
);
2727
}
2828
}

proofs/adapter/filesystem.php

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -18,13 +18,13 @@
1818
use Innmind\BlackBox\Set;
1919
use Symfony\Component\Filesystem\Filesystem as FS;
2020

21-
return static function() {
21+
return static function($prove) {
2222
$path = \rtrim(\sys_get_temp_dir(), '/').'/innmind/filesystem/';
2323

24-
yield properties(
24+
yield $prove->properties(
2525
'Filesystem properties',
2626
PAdapter::properties(),
27-
Set::call(static function() use ($path) {
27+
Set::of(static function() use ($path) {
2828
(new FS)->remove($path);
2929

3030
return Adapter::mount(
@@ -40,25 +40,27 @@
4040
);
4141

4242
foreach (PAdapter::alwaysApplicable() as $property) {
43-
yield property(
44-
$property,
45-
Set::call(static function() use ($path) {
46-
(new FS)->remove($path);
43+
yield $prove
44+
->property(
45+
$property,
46+
Set::of(static function() use ($path) {
47+
(new FS)->remove($path);
4748

48-
return Adapter::mount(
49-
Path::of($path),
50-
match (\PHP_OS) {
51-
'Darwin' => CaseSensitivity::insensitive,
52-
default => CaseSensitivity::sensitive,
53-
},
54-
)
55-
->recover(Recover::mount(...))
56-
->unwrap();
57-
}),
58-
)->named('Filesystem');
49+
return Adapter::mount(
50+
Path::of($path),
51+
match (\PHP_OS) {
52+
'Darwin' => CaseSensitivity::insensitive,
53+
default => CaseSensitivity::sensitive,
54+
},
55+
)
56+
->recover(Recover::mount(...))
57+
->unwrap();
58+
}),
59+
)
60+
->named('Filesystem');
5961
}
6062

61-
yield test(
63+
yield $prove->test(
6264
'Regression adding file in directory due to case sensitivity',
6365
static function($assert) use ($path) {
6466
$property = new PAdapter\AddRemoveAddModificationsStillAddTheFile(
@@ -86,10 +88,10 @@ static function($assert) use ($path) {
8688
);
8789

8890
foreach (CaseSensitivity::cases() as $case) {
89-
yield properties(
91+
yield $prove->properties(
9092
'Filesystem properties on simulated disk',
9193
PAdapter::properties(),
92-
Set::call(static fn() => Adapter::mount(
94+
Set::of(static fn() => Adapter::mount(
9395
Path::of('/'),
9496
$case,
9597
IO::simulation(
@@ -100,17 +102,19 @@ static function($assert) use ($path) {
100102
);
101103

102104
foreach (PAdapter::alwaysApplicable() as $property) {
103-
yield property(
104-
$property,
105-
Set::call(static fn() => Adapter::mount(
106-
Path::of('/'),
107-
$case,
108-
IO::simulation(
109-
IO::fromAmbientAuthority(),
110-
Disk::new(),
111-
),
112-
)->unwrap()),
113-
)->named('Filesystem on simulated disk');
105+
yield $prove
106+
->property(
107+
$property,
108+
Set::of(static fn() => Adapter::mount(
109+
Path::of('/'),
110+
$case,
111+
IO::simulation(
112+
IO::fromAmbientAuthority(),
113+
Disk::new(),
114+
),
115+
)->unwrap()),
116+
)
117+
->named('Filesystem on simulated disk');
114118
}
115119
}
116120
};

proofs/adapter/inMemory.php

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,21 +10,23 @@
1010
use Properties\Innmind\Filesystem\Adapter as PAdapter;
1111
use Innmind\BlackBox\Set;
1212

13-
return static function() {
14-
yield properties(
13+
return static function($prove) {
14+
yield $prove->properties(
1515
'InMemory properties emulating filesystem',
1616
PAdapter::properties(),
17-
Set::call(Adapter::inMemory(...)),
17+
Set::of(Adapter::inMemory(...)),
1818
);
1919

2020
foreach (PAdapter::alwaysApplicable() as $property) {
21-
yield property(
22-
$property,
23-
Set::call(Adapter::inMemory(...)),
24-
)->named('InMemory emulating filesystem');
21+
yield $prove
22+
->property(
23+
$property,
24+
Set::of(Adapter::inMemory(...)),
25+
)
26+
->named('InMemory emulating filesystem');
2527
}
2628

27-
yield test(
29+
yield $prove->test(
2830
'Adding a file in a directory should not remove other files starting with the same name',
2931
static function($assert) {
3032
$adapter = Adapter::inMemory();

proofs/directory/directory.php

Lines changed: 36 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -10,13 +10,16 @@
1010
use Properties\Innmind\Filesystem\Directory as PDirectory;
1111
use Innmind\BlackBox\Set;
1212

13-
return static function() {
14-
yield properties(
13+
return static function($prove) {
14+
yield $prove->properties(
1515
'Empty Directory properties',
1616
PDirectory::properties(),
17-
Name::any()->map(Directory::of(...)),
17+
Name::any()
18+
->map(Directory::of(...))
19+
->map(static fn($directory) => static fn() => $directory),
1820
);
19-
yield properties(
21+
22+
yield $prove->properties(
2023
'Non empty Directory properties',
2124
PDirectory::properties(),
2225
Set::compose(
@@ -32,30 +35,37 @@
3235
->groupBy(static fn($file) => $file->name()->toString())
3336
->size() === $files->size(), // do not accept duplicated files
3437
),
35-
),
38+
)->map(static fn($directory) => static fn() => $directory),
3639
);
3740

3841
foreach (PDirectory::alwaysApplicable() as $property) {
39-
yield property(
40-
$property,
41-
Name::any()->map(Directory::of(...)),
42-
)->named('Empty Directory');
43-
yield property(
44-
$property,
45-
Set::compose(
46-
Directory::of(...),
47-
Name::any(),
48-
Sequence::of(
49-
File::any()->randomize(),
50-
Set::integers()
51-
->between(1, 5) // only to speed up tests
52-
->toSet(),
53-
)->filter(
54-
static fn($files) => $files
55-
->groupBy(static fn($file) => $file->name()->toString())
56-
->size() === $files->size(), // do not accept duplicated files
57-
),
58-
),
59-
)->named('Non empty Directory');
42+
yield $prove
43+
->property(
44+
$property,
45+
Name::any()
46+
->map(Directory::of(...))
47+
->map(static fn($directory) => static fn() => $directory),
48+
)
49+
->named('Empty Directory');
50+
51+
yield $prove
52+
->property(
53+
$property,
54+
Set::compose(
55+
Directory::of(...),
56+
Name::any(),
57+
Sequence::of(
58+
File::any()->randomize(),
59+
Set::integers()
60+
->between(1, 5) // only to speed up tests
61+
->toSet(),
62+
)->filter(
63+
static fn($files) => $files
64+
->groupBy(static fn($file) => $file->name()->toString())
65+
->size() === $files->size(), // do not accept duplicated files
66+
),
67+
)->map(static fn($directory) => static fn() => $directory),
68+
)
69+
->named('Non empty Directory');
6070
}
6171
};

proofs/file.php

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33

44
use Fixtures\Innmind\Filesystem\File;
55

6-
return static function() {
7-
yield proof(
8-
'File::mapContent()',
9-
given(
6+
return static function($prove) {
7+
yield $prove
8+
->proof('File::mapContent()')
9+
->given(
1010
File::any(),
1111
File::any(),
12-
),
13-
static function($assert, $file, $replacement) {
12+
)
13+
->test(static function($assert, $file, $replacement) {
1414
$new = $file->mapContent(static function($content) use ($assert, $file, $replacement) {
1515
$assert->same($file->content(), $content);
1616

@@ -24,6 +24,5 @@ static function($assert, $file, $replacement) {
2424
$assert->same($file->name(), $new->name());
2525
$assert->same($file->mediaType(), $new->mediaType());
2626
$assert->same($replacement->content(), $new->content());
27-
},
28-
);
27+
});
2928
};

0 commit comments

Comments
 (0)