mirror of
https://github.com/pestphp/pest.git
synced 2026-12-06 15:52:16 +01:00
Fail when a snapshot cannot be written (#2048)
Co-authored-by: haranishi <223786623+haranishi@users.noreply.github.com> Co-authored-by: Punyapal Shah <mrpunyapal@gmail.com>
This commit is contained in:
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
||||
namespace Pest\Repositories;
|
||||
|
||||
use Pest\Exceptions\ShouldNotHappen;
|
||||
use RuntimeException;
|
||||
|
||||
/**
|
||||
* @internal
|
||||
@@ -48,7 +49,9 @@ final readonly class Snapshot
|
||||
@mkdir($directory, 0755, true);
|
||||
}
|
||||
|
||||
file_put_contents($this->filename, $contents);
|
||||
if (@file_put_contents($this->filename, $contents) !== strlen($contents)) {
|
||||
throw new RuntimeException(sprintf('Unable to write snapshot at [%s].', $this->path()));
|
||||
}
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user