@@ -78,8 +78,6 @@ public static function fromTestResponse(TestResponse $response): self
7878 PHPUnit::assertArrayHasKey ('props ' , $ page );
7979 PHPUnit::assertArrayHasKey ('url ' , $ page );
8080 PHPUnit::assertArrayHasKey ('version ' , $ page );
81- PHPUnit::assertArrayHasKey ('encryptHistory ' , $ page );
82- PHPUnit::assertArrayHasKey ('clearHistory ' , $ page );
8381 } catch (AssertionFailedError $ e ) {
8482 PHPUnit::fail ('Not a valid Inertia response. ' );
8583 }
@@ -88,8 +86,8 @@ public static function fromTestResponse(TestResponse $response): self
8886 $ instance ->component = $ page ['component ' ];
8987 $ instance ->url = $ page ['url ' ];
9088 $ instance ->version = $ page ['version ' ];
91- $ instance ->encryptHistory = $ page ['encryptHistory ' ];
92- $ instance ->clearHistory = $ page ['clearHistory ' ];
89+ $ instance ->encryptHistory = isset ( $ page ['encryptHistory ' ]) ;
90+ $ instance ->clearHistory = isset ( $ page ['clearHistory ' ]) ;
9391 $ instance ->deferredProps = $ page ['deferredProps ' ] ?? [];
9492 $ instance ->flash = $ page ['flash ' ] ?? [];
9593
@@ -291,14 +289,16 @@ public static function assertFlashMissing(array $flash, string $key): void
291289 */
292290 public function toArray ()
293291 {
294- return [
295- 'component ' => $ this ->component ,
296- 'props ' => $ this ->prop (),
297- 'url ' => $ this ->url ,
298- 'version ' => $ this ->version ,
299- 'encryptHistory ' => $ this ->encryptHistory ,
300- 'clearHistory ' => $ this ->clearHistory ,
301- 'flash ' => $ this ->flash ,
302- ];
292+ return array_merge (
293+ [
294+ 'component ' => $ this ->component ,
295+ 'props ' => $ this ->prop (),
296+ 'url ' => $ this ->url ,
297+ 'version ' => $ this ->version ,
298+ 'flash ' => $ this ->flash ,
299+ ],
300+ $ this ->encryptHistory ? ['encryptHistory ' => true ] : [],
301+ $ this ->clearHistory ? ['clearHistory ' => true ] : [],
302+ );
303303 }
304304}
0 commit comments