feat(expect): add more methods

This commit is contained in:
ceceppa
2020-07-16 07:34:43 +01:00
parent 1e61144cd2
commit f0f79ab244
5 changed files with 110 additions and 3 deletions

View File

@ -372,6 +372,46 @@ final class Expectation
return $this;
}
/**
* Assert that the value array has the key.
*/
public function toHaveKey(string $key): Expectation
{
Assert::assertArrayHasKey($key, $this->value);
return $this;
}
/**
* Assert that the value is a directory.
*/
public function toBeDirectory(): Expectation
{
Assert::assertDirectoryExists($this->value);
return $this;
}
/**
* Assert that the value is a directory and is readable.
*/
public function toBeReadableDirectory(): Expectation
{
Assert::assertDirectoryIsReadable($this->value);
return $this;
}
/**
* Assert that the value is a directory and is writable.
*/
public function toBeWritableDirectory(): Expectation
{
Assert::assertDirectoryIsWritable($this->value);
return $this;
}
/**
* Dynamically calls methods on the class without any arguments.
*