![]() Server : Apache System : Linux server2.corals.io 4.18.0-348.2.1.el8_5.x86_64 #1 SMP Mon Nov 15 09:17:08 EST 2021 x86_64 User : corals ( 1002) PHP Version : 7.4.33 Disable Function : exec,passthru,shell_exec,system Directory : /home/corals/rentpix.corals.io/vendor/spatie/phpunit-snapshot-assertions/src/ |
<?php namespace Spatie\Snapshots; class Snapshot { /** @var string */ private $id; /** @var \Spatie\Snapshots\Filesystem */ private $filesystem; /** @var \Spatie\Snapshots\Driver */ private $driver; public function __construct( string $id, Filesystem $filesystem, Driver $driver ) { $this->id = $id; $this->filesystem = $filesystem; $this->driver = $driver; } public static function forTestCase( string $id, string $directory, Driver $driver ): self { $filesystem = Filesystem::inDirectory($directory); return new self($id, $filesystem, $driver); } public function id(): string { return $this->id; } public function filename(): string { $file = $this->id.'.'.$this->driver->extension(); return Filename::cleanFilename($file); } public function exists(): bool { return $this->filesystem->has($this->filename()); } public function assertMatches($actual) { $this->driver->match($this->filesystem->read($this->filename()), $actual); } public function create($actual) { $this->filesystem->put($this->filename(), $this->driver->serialize($actual)); } }