Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 12 additions & 12 deletions tests/Adapter/FilesystemTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -355,17 +355,17 @@ public function testPathTooLongThrowAnException()
))->unwrap();
}

public function testPersistedNameCanStartWithAnyAsciiCharacter()
public function testPersistedNameCanStartWithAnyAsciiCharacter(): BlackBox\Proof
{
$this
return $this
->forAll(
Set::either(
Set::integers()->between(1, 46),
Set::integers()->between(48, 127),
),
Set::strings(),
)
->then(function($ord, $content) {
->prove(function($ord, $content) {
$path = \sys_get_temp_dir().'/innmind/filesystem/';
(new FS)->remove($path);

Expand All @@ -390,17 +390,17 @@ public function testPersistedNameCanStartWithAnyAsciiCharacter()
});
}

public function testPersistedNameCanContainWithAnyAsciiCharacter()
public function testPersistedNameCanContainWithAnyAsciiCharacter(): BlackBox\Proof
{
$this
return $this
->forAll(
Set::either(
Set::integers()->between(1, 46),
Set::integers()->between(48, 127),
),
Set::strings(),
)
->then(function($ord, $content) {
->prove(function($ord, $content) {
$path = \sys_get_temp_dir().'/innmind/filesystem/';
(new FS)->remove($path);

Expand All @@ -425,9 +425,9 @@ public function testPersistedNameCanContainWithAnyAsciiCharacter()
});
}

public function testPersistedNameCanContainOnlyOneAsciiCharacter()
public function testPersistedNameCanContainOnlyOneAsciiCharacter(): BlackBox\Proof
{
$this
return $this
->forAll(
Set::either(
Set::integers()->between(1, 8),
Expand All @@ -437,7 +437,7 @@ public function testPersistedNameCanContainOnlyOneAsciiCharacter()
),
Set::strings(),
)
->then(function($ord, $content) {
->prove(function($ord, $content) {
$path = \sys_get_temp_dir().'/innmind/filesystem/';
(new FS)->remove($path);

Expand Down Expand Up @@ -502,11 +502,11 @@ public function testThrowsWhenListContainsALink()
);
}

public function testDotFilesAreListed()
public function testDotFilesAreListed(): BlackBox\Proof
{
$this
return $this
->forAll(FName::strings()->prefixedBy('.'))
->then(function($name) {
->prove(function($name) {
$path = \sys_get_temp_dir().'/innmind/filesystem/';
(new FS)->remove($path);
(new FS)->mkdir($path);
Expand Down
18 changes: 9 additions & 9 deletions tests/DirectoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -186,14 +186,14 @@ public function testFilter()
$this->assertSame('foobar', $files->toList()[1]->name()->toString());
}

public function testDirectoryLoadedWithDifferentFilesWithTheSameNameThrows()
public function testDirectoryLoadedWithDifferentFilesWithTheSameNameThrows(): BlackBox\Proof
{
$this
return $this
->forAll(
FName::any(),
FName::any(),
)
->then(function($directory, $file) {
->prove(function($directory, $file) {
$this->expectException(\LogicException::class);
$this->expectExceptionMessage("Same file '{$file->toString()}' found multiple times");

Expand All @@ -207,14 +207,14 @@ public function testDirectoryLoadedWithDifferentFilesWithTheSameNameThrows()
});
}

public function testNamedDirectoryLoadedWithDifferentFilesWithTheSameNameThrows()
public function testNamedDirectoryLoadedWithDifferentFilesWithTheSameNameThrows(): BlackBox\Proof
{
$this
return $this
->forAll(
FName::any(),
FName::any(),
)
->then(function($directory, $file) {
->prove(function($directory, $file) {
$this->expectException(\LogicException::class);
$this->expectExceptionMessage("Same file '{$file->toString()}' found multiple times");

Expand All @@ -228,11 +228,11 @@ public function testNamedDirectoryLoadedWithDifferentFilesWithTheSameNameThrows(
});
}

public function testLazyLoadingADirectoryDoesntLoadFiles()
public function testLazyLoadingADirectoryDoesntLoadFiles(): BlackBox\Proof
{
$this
return $this
->forAll(FName::any())
->then(function($name) {
->prove(function($name) {
$this->assertInstanceOf(
Directory::class,
Directory::lazy(
Expand Down
30 changes: 15 additions & 15 deletions tests/File/Content/LineTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ class LineTest extends TestCase
{
use BlackBox;

public function testDoesntAcceptNewLineDelimiter()
public function testDoesntAcceptNewLineDelimiter(): BlackBox\Proof
{
$this
return $this
->forAll(
Set::strings()->unicode(),
Set::strings()->unicode(),
)
->then(function($start, $end) {
->prove(function($start, $end) {
try {
Line::of(Str::of($start."\n".$end));

Expand All @@ -33,35 +33,35 @@ public function testDoesntAcceptNewLineDelimiter()
});
}

public function testLineIsNotAltered()
public function testLineIsNotAltered(): BlackBox\Proof
{
$this
return $this
->forAll($this->strings())
->then(function($content) {
->prove(function($content) {
$this->assertSame($content, Line::of(Str::of($content))->toString());
});
}

public function testEndOfLineDelimiterIsRemovedAutomaticallyWhenReadingFromStream()
public function testEndOfLineDelimiterIsRemovedAutomaticallyWhenReadingFromStream(): BlackBox\Proof
{
$this
return $this
->forAll(Set::strings()->unicode())
->then(function($content) {
->prove(function($content) {
$this->assertStringEndsNotWith(
"\n",
Line::fromStream(Str::of($content))->toString(),
);
});
}

public function testMap()
public function testMap(): BlackBox\Proof
{
$this
return $this
->forAll(
$this->strings(),
$this->strings(),
)
->then(function($original, $replacement) {
->prove(function($original, $replacement) {
$line = Line::of(Str::of($original));
$mapped = $line->map(function($content) use ($original, $replacement) {
$this->assertSame($original, $content->toString());
Expand All @@ -75,11 +75,11 @@ public function testMap()
});
}

public function testMappedLineCannotContainEndOfLineDelimiter()
public function testMappedLineCannotContainEndOfLineDelimiter(): BlackBox\Proof
{
$this
return $this
->forAll($this->strings())
->then(function($content) {
->prove(function($content) {
$line = Line::of(Str::of($content));

try {
Expand Down
36 changes: 18 additions & 18 deletions tests/FileTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,14 +54,14 @@ public function testMediaType()
$this->assertSame($mt, $f->mediaType());
}

public function testContentIsNeverAltered()
public function testContentIsNeverAltered(): BlackBox\Proof
{
$this
return $this
->forAll(
FName::any(),
FMediaType::any(),
)
->then(function($name, $mediaType) {
->prove(function($name, $mediaType) {
$file = File::of(
$name,
$content = Content::none(),
Expand All @@ -74,11 +74,11 @@ public function testContentIsNeverAltered()
});
}

public function testByDefaultTheMediaTypeIsOctetStream()
public function testByDefaultTheMediaTypeIsOctetStream(): BlackBox\Proof
{
$this
return $this
->forAll(FName::any())
->then(function($name) {
->prove(function($name) {
$file = File::of(
$name,
Content::none(),
Expand All @@ -91,14 +91,14 @@ public function testByDefaultTheMediaTypeIsOctetStream()
});
}

public function testNamedConstructorNeverAltersTheContent()
public function testNamedConstructorNeverAltersTheContent(): BlackBox\Proof
{
$this
return $this
->forAll(
FName::any(),
FMediaType::any(),
)
->then(function($name, $mediaType) {
->prove(function($name, $mediaType) {
$file = File::named(
$name->toString(),
$content = Content::none(),
Expand All @@ -111,14 +111,14 @@ public function testNamedConstructorNeverAltersTheContent()
});
}

public function testWithContent()
public function testWithContent(): BlackBox\Proof
{
$this
return $this
->forAll(
FName::any(),
FMediaType::any(),
)
->then(function($name, $mediaType) {
->prove(function($name, $mediaType) {
$file = File::of(
$name,
$content = Content::none(),
Expand All @@ -133,14 +133,14 @@ public function testWithContent()
});
}

public function testWithContentKeepsTheMediaTypeByDefault()
public function testWithContentKeepsTheMediaTypeByDefault(): BlackBox\Proof
{
$this
return $this
->forAll(
FName::any(),
FMediaType::any(),
)
->then(function($name, $mediaType) {
->prove(function($name, $mediaType) {
$file = File::of(
$name,
Content::none(),
Expand All @@ -153,14 +153,14 @@ public function testWithContentKeepsTheMediaTypeByDefault()
});
}

public function testRename()
public function testRename(): BlackBox\Proof
{
$this
return $this
->forAll(
FName::any(),
FName::any(),
)
->then(function($name1, $name2) {
->prove(function($name1, $name2) {
$file1 = File::of(
$name1,
Content::none(),
Expand Down
Loading