\n
\n
Snapshot<\/h1>\n <\/div>\n <\/div>\n <\/div>"
+}
\ No newline at end of file
diff --git a/tests/.snapshots/version-command.txt b/tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap
similarity index 100%
rename from tests/.snapshots/version-command.txt
rename to tests/.pest/snapshots/Visual/Version/visual_snapshot_of_help_command_output.snap
diff --git a/tests/.snapshots/coverage.txt b/tests/.snapshots/coverage.txt
deleted file mode 100644
index e7cf7549..00000000
--- a/tests/.snapshots/coverage.txt
+++ /dev/null
@@ -1,60 +0,0 @@
-
- PASS Tests\Playground
- ✓ basic
-
- Tests: 1 passed
- Time: 0.20s
- Cov: 6.49%
-
- Actions/AddsDefaults ........................................... 0.0 %
- Actions/AddsTests .............................................. 0.0 %
- Actions/LoadStructure .......................................... 0.0 %
- Actions/ValidatesConfiguration ................................. 0.0 %
- Actions/ValidatesEnvironment ................................... 0.0 %
- Concerns/TestCase 40..54, 71..88, 123..126, 147 ............... 44.4 %
- Console/Command ................................................ 0.0 %
- Contracts/HasPrintableTestCaseName ............................. 0.0 %
- Contracts/Plugins/AddsOutput ................................ 100.0 %
- Contracts/Plugins/HandlesArguments .......................... 100.0 %
- Datasets ....................................................... 0.0 %
- Exceptions/AfterAllAlreadyExist ................................ 0.0 %
- Exceptions/AfterEachAlreadyExist ............................... 0.0 %
- Exceptions/AttributeNotSupportedYet ............................ 0.0 %
- Exceptions/BeforeEachAlreadyExist .............................. 0.0 %
- Exceptions/DatasetAlreadyExist ................................. 0.0 %
- Exceptions/DatasetDoesNotExist ................................. 0.0 %
- Exceptions/FileOrFolderNotFound ................................ 0.0 %
- Exceptions/InvalidConsoleArgument .............................. 0.0 %
- Exceptions/InvalidPestCommand .................................. 0.0 %
- Exceptions/InvalidUsesPath ..................................... 0.0 %
- Exceptions/ShouldNotHappen ..................................... 0.0 %
- Exceptions/TestAlreadyExist .................................... 0.0 %
- Exceptions/TestCaseAlreadyInUse ................................ 0.0 %
- Exceptions/TestCaseClassOrTraitNotFound ........................ 0.0 %
- Factories/TestCaseFactory 111..133, 141..204 ................... 8.2 %
- Laravel/Commands/PestDatasetCommand ............................ 0.0 %
- Laravel/Commands/PestInstallCommand ............................ 0.0 %
- Laravel/Commands/PestTestCommand ............................... 0.0 %
- Laravel/PestServiceProvider .................................... 0.0 %
- PendingObjects/AfterEachCall ................................... 0.0 %
- PendingObjects/BeforeEachCall .................................. 0.0 %
- PendingObjects/TestCall ........................................ 0.0 %
- PendingObjects/UsesCall ........................................ 0.0 %
- Plugin ......................................................... 0.0 %
- Repositories/AfterAllRepository ................................ 0.0 %
- Repositories/AfterEachRepository 28..33 ....................... 60.0 %
- Repositories/BeforeAllRepository ............................... 0.0 %
- Repositories/BeforeEachRepository 26..31 ...................... 20.0 %
- Repositories/TestRepository .................................... 0.0 %
- Support/Backtrace .............................................. 0.0 %
- Support/ChainableClosure .................................... 100.0 %
- Support/Container .............................................. 0.0 %
- Support/ExceptionTrace 25..32 ................................. 28.6 %
- Support/HigherOrderMessage ..................................... 0.0 %
- Support/HigherOrderMessageCollection 24..25, 33, 43 ........... 50.0 %
- Support/HigherOrderTapProxy .................................... 0.0 %
- Support/NullClosure ......................................... 100.0 %
- Support/Reflection ............................................. 0.0 %
- Support/Str .................................................... 0.0 %
- TestSuite 80..87, 95..101, 105 ................................ 20.0 %
- globals ........................................................ 0.0 %
diff --git a/tests/.snapshots/success.txt b/tests/.snapshots/success.txt
index 4927d35c..45efb415 100644
--- a/tests/.snapshots/success.txt
+++ b/tests/.snapshots/success.txt
@@ -673,6 +673,8 @@
✓ pass with toString
✓ pass with dataset with ('my-datas-set-value')
✓ within describe → pass with dataset with ('my-datas-set-value')
+ ✓ pass with toArray
+ ✓ pass with array
✓ failures
✓ failures with custom message
✓ not failures
@@ -1079,7 +1081,7 @@
✓ todo
✓ todo in parallel
- PASS Tests\Visual\Version
- ✓ visual snapshot of help command output
+ WARN Tests\Visual\Version
+ - visual snapshot of help command output
- Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 18 skipped, 741 passed (1784 assertions)
\ No newline at end of file
+ Tests: 2 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 19 skipped, 742 passed (1787 assertions)
\ No newline at end of file
diff --git a/tests/Features/Expect/toMatchSnapshot.php b/tests/Features/Expect/toMatchSnapshot.php
index 8887e2e1..29a63a59 100644
--- a/tests/Features/Expect/toMatchSnapshot.php
+++ b/tests/Features/Expect/toMatchSnapshot.php
@@ -75,6 +75,34 @@ describe('within describe', function () {
});
})->with(['my-datas-set-value']);
+test('pass with `toArray`', function () {
+ TestSuite::getInstance()->snapshots->save($this, json_encode(['key' => $this->snapshotable], JSON_PRETTY_PRINT));
+
+ $object = new class($this->snapshotable)
+ {
+ public function __construct(protected string $snapshotable)
+ {
+ }
+
+ public function toArray()
+ {
+ return [
+ 'key' => $this->snapshotable,
+ ];
+ }
+ };
+
+ expect($object)->toMatchSnapshot()->toMatchSnapshot();
+});
+
+test('pass with array', function () {
+ TestSuite::getInstance()->snapshots->save($this, json_encode(['key' => $this->snapshotable], JSON_PRETTY_PRINT));
+
+ expect([
+ 'key' => $this->snapshotable,
+ ])->toMatchSnapshot()->toMatchSnapshot();
+});
+
test('failures', function () {
TestSuite::getInstance()->snapshots->save($this, $this->snapshotable);
diff --git a/tests/Visual/Parallel.php b/tests/Visual/Parallel.php
index d44a5de3..eff61789 100644
--- a/tests/Visual/Parallel.php
+++ b/tests/Visual/Parallel.php
@@ -16,7 +16,7 @@ $run = function () {
test('parallel', function () use ($run) {
expect($run('--exclude-group=integration'))
- ->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 15 skipped, 730 passed (1769 assertions)')
+ ->toContain('Tests: 1 deprecated, 4 warnings, 5 incomplete, 2 notices, 13 todos, 15 skipped, 732 passed (1773 assertions)')
->toContain('Parallel: 3 processes');
})->skipOnWindows();
diff --git a/tests/Visual/Version.php b/tests/Visual/Version.php
index 7db09e3c..50b156b8 100644
--- a/tests/Visual/Version.php
+++ b/tests/Visual/Version.php
@@ -1,8 +1,6 @@
'DefaultPrinter', 'COLLISION_IGNORE_DURATION' => 'true']));
@@ -11,11 +9,5 @@ test('visual snapshot of help command output', function () {
return preg_replace('#\\x1b[[][^A-Za-z]*[A-Za-z]#', '', $process->getOutput());
};
- if (getenv('REBUILD_SNAPSHOTS')) {
- file_put_contents($snapshot, $output());
-
- $this->markTestSkipped('Snapshot rebuilt.');
- }
-
- expect($output())->toContain(file_get_contents($snapshot));
-})->skipOnWindows();
+ expect($output())->toMatchSnapshot();
+})->skipOnWindows()->skip(! getenv('REBUILD_SNAPSHOTS') && getenv('EXCLUDE'));