Skip to content

Commit 7e6a030

Browse files
committed
Merge branch '1.x' of github.com:inertiajs/inertia-laravel into 1.x
2 parents f6bd63a + f6d3e16 commit 7e6a030

11 files changed

+19
-16
lines changed

Diff for: src/Response.php

+2
Original file line numberDiff line numberDiff line change
@@ -95,6 +95,8 @@ public function toResponse($request)
9595
'props' => $props,
9696
'url' => Str::start(Str::after($request->fullUrl(), $request->getSchemeAndHttpHost()), '/'),
9797
'version' => $this->version,
98+
'encryptHistory' => false,
99+
'clearHistory' => false,
98100
];
99101

100102
if ($request->header(Header::INERTIA)) {

Diff for: src/ResponseFactory.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function share($key, $value = null): void
4646
}
4747
}
4848

49-
public function getShared(string $key = null, $default = null)
49+
public function getShared(?string $key = null, $default = null)
5050
{
5151
if ($key) {
5252
return Arr::get($this->sharedProps, $key, $default);

Diff for: src/Testing/AssertableInertia.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public static function fromTestResponse(TestResponse $response): self
4242
return $instance;
4343
}
4444

45-
public function component(string $value = null, $shouldExist = null): self
45+
public function component(?string $value = null, $shouldExist = null): self
4646
{
4747
PHPUnit::assertSame($value, $this->component, 'Unexpected Inertia page component.');
4848

Diff for: src/Testing/Concerns/Debugging.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,17 @@
44

55
trait Debugging
66
{
7-
public function dump(string $prop = null): self
7+
public function dump(?string $prop = null): self
88
{
99
dump($this->prop($prop));
1010

1111
return $this;
1212
}
1313

14-
public function dd(string $prop = null): void
14+
public function dd(?string $prop = null): void
1515
{
1616
dd($this->prop($prop));
1717
}
1818

19-
abstract protected function prop(string $key = null);
19+
abstract protected function prop(?string $key = null);
2020
}

Diff for: src/Testing/Concerns/Has.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function hasAll($key): self
3838
/**
3939
* @return $this
4040
*/
41-
public function has(string $key, $value = null, Closure $scope = null): self
41+
public function has(string $key, $value = null, ?Closure $scope = null): self
4242
{
4343
PHPUnit::assertTrue(
4444
Arr::has($this->prop(), $key),
@@ -106,7 +106,7 @@ public function misses(string $key): self
106106
return $this->missing($key);
107107
}
108108

109-
abstract protected function prop(string $key = null);
109+
abstract protected function prop(?string $key = null);
110110

111111
abstract protected function dotPath(string $key): string;
112112

Diff for: src/Testing/Concerns/Interaction.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,5 +37,5 @@ public function etc(): self
3737
return $this;
3838
}
3939

40-
abstract protected function prop(string $key = null);
40+
abstract protected function prop(?string $key = null);
4141
}

Diff for: src/Testing/Concerns/Matching.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected function ensureSorted(&$value): void
6868

6969
abstract protected function dotPath(string $key): string;
7070

71-
abstract protected function prop(string $key = null);
71+
abstract protected function prop(?string $key = null);
7272

73-
abstract public function has(string $key, $value = null, Closure $scope = null);
73+
abstract public function has(string $key, $value = null, ?Closure $scope = null);
7474
}

Diff for: src/Testing/Concerns/PageObject.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88

99
trait PageObject
1010
{
11-
public function component(string $value = null, $shouldExist = null): self
11+
public function component(?string $value = null, $shouldExist = null): self
1212
{
1313
PHPUnit::assertSame($value, $this->component, 'Unexpected Inertia page component.');
1414

@@ -23,7 +23,7 @@ public function component(string $value = null, $shouldExist = null): self
2323
return $this;
2424
}
2525

26-
protected function prop(string $key = null)
26+
protected function prop(?string $key = null)
2727
{
2828
return Arr::get($this->props, $key);
2929
}

Diff for: src/Testing/TestResponseMacros.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ class TestResponseMacros
88
{
99
public function assertInertia()
1010
{
11-
return function (Closure $callback = null) {
11+
return function (?Closure $callback = null) {
1212
$assert = AssertableInertia::fromTestResponse($this);
1313

1414
if (is_null($callback)) {

Diff for: tests/ControllerTest.php

+2
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ public function test_controller_returns_an_inertia_response(): void
2828
],
2929
'url' => '/',
3030
'version' => '',
31+
'encryptHistory' => false,
32+
'clearHistory' => false,
3133
]);
3234
}
3335
}

Diff for: tests/ResponseTest.php

+2-3
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function test_server_response(): void
4646
$this->assertSame('Jonathan', $page['props']['user']['name']);
4747
$this->assertSame('/user/123', $page['url']);
4848
$this->assertSame('123', $page['version']);
49-
$this->assertSame('<div id="app" data-page="{&quot;component&quot;:&quot;User\/Edit&quot;,&quot;props&quot;:{&quot;user&quot;:{&quot;name&quot;:&quot;Jonathan&quot;}},&quot;url&quot;:&quot;\/user\/123&quot;,&quot;version&quot;:&quot;123&quot;}"></div>', $view->render());
49+
$this->assertSame('<div id="app" data-page="{&quot;component&quot;:&quot;User\/Edit&quot;,&quot;props&quot;:{&quot;user&quot;:{&quot;name&quot;:&quot;Jonathan&quot;}},&quot;url&quot;:&quot;\/user\/123&quot;,&quot;version&quot;:&quot;123&quot;,&quot;encryptHistory&quot;:false,&quot;clearHistory&quot;:false}"></div>', $view->render());
5050
}
5151

5252
public function test_xhr_response(): void
@@ -98,8 +98,7 @@ public function test_lazy_resource_response(): void
9898
$callable = static function () use ($users) {
9999
$page = new LengthAwarePaginator($users->take(2), $users->count(), 2);
100100

101-
return new class($page, JsonResource::class) extends ResourceCollection {
102-
};
101+
return new class($page, JsonResource::class) extends ResourceCollection {};
103102
};
104103

105104
$response = new Response('User/Index', ['users' => $callable], 'app', '123');

0 commit comments

Comments
 (0)