From 50cd1056eb818ee79d2ed54c24c737ea6d1cf1e3 Mon Sep 17 00:00:00 2001 From: Owen Voke Date: Wed, 12 Aug 2020 12:24:00 +0100 Subject: [PATCH] feat(expectations): add file assertions --- src/Expectation.php | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) diff --git a/src/Expectation.php b/src/Expectation.php index 0770e367..4e5b9633 100644 --- a/src/Expectation.php +++ b/src/Expectation.php @@ -414,6 +414,36 @@ final class Expectation return $this; } + /** + * Asserts that the value is a file. + */ + public function toBeFile(): Expectation + { + Assert::assertFileExists($this->value); + + return $this; + } + + /** + * Asserts that the value is a file and is readable. + */ + public function toBeReadableFile(): Expectation + { + Assert::assertFileIsReadable($this->value); + + return $this; + } + + /** + * Asserts that the value is a file and is writable. + */ + public function toBeWritableFile(): Expectation + { + Assert::assertFileIsWritable($this->value); + + return $this; + } + /** * Dynamically calls methods on the class without any arguments. *