| @@ 16-49 (lines=34) @@ | ||
| 13 | use expect\FailedMessage; |
|
| 14 | use expect\matcher\ReportableMatcher; |
|
| 15 | ||
| 16 | final class ToBeDirectory implements ReportableMatcher |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | private $actual; |
|
| 22 | ||
| 23 | public function match($actual) |
|
| 24 | { |
|
| 25 | $this->actual = $actual; |
|
| 26 | ||
| 27 | return is_dir($this->actual); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * {@inheritdoc} |
|
| 32 | */ |
|
| 33 | public function reportFailed(FailedMessage $message) |
|
| 34 | { |
|
| 35 | $message->appendText('Expected ') |
|
| 36 | ->appendValue($this->actual) |
|
| 37 | ->appendText(' to be directory'); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function reportNegativeFailed(FailedMessage $message) |
|
| 44 | { |
|
| 45 | $message->appendText('Expected ') |
|
| 46 | ->appendValue($this->actual) |
|
| 47 | ->appendText(' not to be directory'); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 16-49 (lines=34) @@ | ||
| 13 | use expect\FailedMessage; |
|
| 14 | use expect\matcher\ReportableMatcher; |
|
| 15 | ||
| 16 | final class ToBeExecutable implements ReportableMatcher |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | private $actual; |
|
| 22 | ||
| 23 | public function match($actual) |
|
| 24 | { |
|
| 25 | $this->actual = $actual; |
|
| 26 | ||
| 27 | return is_executable($this->actual); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * {@inheritdoc} |
|
| 32 | */ |
|
| 33 | public function reportFailed(FailedMessage $message) |
|
| 34 | { |
|
| 35 | $message->appendText('Expected ') |
|
| 36 | ->appendValue($this->actual) |
|
| 37 | ->appendText(' to be executable'); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function reportNegativeFailed(FailedMessage $message) |
|
| 44 | { |
|
| 45 | $message->appendText('Expected ') |
|
| 46 | ->appendValue($this->actual) |
|
| 47 | ->appendText(' not to be executable'); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 16-49 (lines=34) @@ | ||
| 13 | use expect\FailedMessage; |
|
| 14 | use expect\matcher\ReportableMatcher; |
|
| 15 | ||
| 16 | final class ToBeExists implements ReportableMatcher |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | private $actual; |
|
| 22 | ||
| 23 | public function match($actual) |
|
| 24 | { |
|
| 25 | $this->actual = $actual; |
|
| 26 | ||
| 27 | return file_exists($this->actual); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * {@inheritdoc} |
|
| 32 | */ |
|
| 33 | public function reportFailed(FailedMessage $message) |
|
| 34 | { |
|
| 35 | $message->appendText('Expected ') |
|
| 36 | ->appendValue($this->actual) |
|
| 37 | ->appendText(' to be exists'); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function reportNegativeFailed(FailedMessage $message) |
|
| 44 | { |
|
| 45 | $message->appendText('Expected ') |
|
| 46 | ->appendValue($this->actual) |
|
| 47 | ->appendText(' not to be exists'); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 16-49 (lines=34) @@ | ||
| 13 | use expect\FailedMessage; |
|
| 14 | use expect\matcher\ReportableMatcher; |
|
| 15 | ||
| 16 | final class ToBeFile implements ReportableMatcher |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | private $actual; |
|
| 22 | ||
| 23 | public function match($actual) |
|
| 24 | { |
|
| 25 | $this->actual = $actual; |
|
| 26 | ||
| 27 | return is_file($this->actual); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * {@inheritdoc} |
|
| 32 | */ |
|
| 33 | public function reportFailed(FailedMessage $message) |
|
| 34 | { |
|
| 35 | $message->appendText('Expected ') |
|
| 36 | ->appendValue($this->actual) |
|
| 37 | ->appendText(' to be file'); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function reportNegativeFailed(FailedMessage $message) |
|
| 44 | { |
|
| 45 | $message->appendText('Expected ') |
|
| 46 | ->appendValue($this->actual) |
|
| 47 | ->appendText(' not to be file'); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 16-49 (lines=34) @@ | ||
| 13 | use expect\FailedMessage; |
|
| 14 | use expect\matcher\ReportableMatcher; |
|
| 15 | ||
| 16 | final class ToBeReadable implements ReportableMatcher |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | private $actual; |
|
| 22 | ||
| 23 | public function match($actual) |
|
| 24 | { |
|
| 25 | $this->actual = $actual; |
|
| 26 | ||
| 27 | return is_readable($this->actual); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * {@inheritdoc} |
|
| 32 | */ |
|
| 33 | public function reportFailed(FailedMessage $message) |
|
| 34 | { |
|
| 35 | $message->appendText('Expected ') |
|
| 36 | ->appendValue($this->actual) |
|
| 37 | ->appendText(' to be readable'); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function reportNegativeFailed(FailedMessage $message) |
|
| 44 | { |
|
| 45 | $message->appendText('Expected ') |
|
| 46 | ->appendValue($this->actual) |
|
| 47 | ->appendText(' not to be readable'); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||
| @@ 16-49 (lines=34) @@ | ||
| 13 | use expect\FailedMessage; |
|
| 14 | use expect\matcher\ReportableMatcher; |
|
| 15 | ||
| 16 | final class ToBeWritable implements ReportableMatcher |
|
| 17 | { |
|
| 18 | /** |
|
| 19 | * @var string |
|
| 20 | */ |
|
| 21 | private $actual; |
|
| 22 | ||
| 23 | public function match($actual) |
|
| 24 | { |
|
| 25 | $this->actual = $actual; |
|
| 26 | ||
| 27 | return is_writable($this->actual); |
|
| 28 | } |
|
| 29 | ||
| 30 | /** |
|
| 31 | * {@inheritdoc} |
|
| 32 | */ |
|
| 33 | public function reportFailed(FailedMessage $message) |
|
| 34 | { |
|
| 35 | $message->appendText('Expected ') |
|
| 36 | ->appendValue($this->actual) |
|
| 37 | ->appendText(' to be writable'); |
|
| 38 | } |
|
| 39 | ||
| 40 | /** |
|
| 41 | * {@inheritdoc} |
|
| 42 | */ |
|
| 43 | public function reportNegativeFailed(FailedMessage $message) |
|
| 44 | { |
|
| 45 | $message->appendText('Expected ') |
|
| 46 | ->appendValue($this->actual) |
|
| 47 | ->appendText(' not to be writable'); |
|
| 48 | } |
|
| 49 | } |
|
| 50 | ||