-
Notifications
You must be signed in to change notification settings - Fork 11.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[11.x] Allow using
Illuminate\Support\Uri
on testing HTTP Requests (#…
…54038) * [11.x] Allow using `Illuminate\Support\Uri` on testing HTTP Requests Signed-off-by: Mior Muhammad Zaki <[email protected]> * wip Signed-off-by: Mior Muhammad Zaki <[email protected]> --------- Signed-off-by: Mior Muhammad Zaki <[email protected]>
- Loading branch information
Showing
2 changed files
with
54 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
tests/Integration/Foundation/Testing/Concerns/MakeHttpRequestsTest.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
namespace Illuminate\Tests\Integration\Foundation\Testing\Concerns; | ||
|
||
use Illuminate\Http\Request; | ||
use Illuminate\Support\Uri; | ||
use Orchestra\Testbench\Attributes\WithConfig; | ||
use Orchestra\Testbench\TestCase; | ||
|
||
#[WithConfig('app.key', 'base64:IUHRqAQ99pZ0A1MPjbuv1D6ff3jxv0GIvS2qIW4JNU4=')] | ||
class MakeHttpRequestsTest extends TestCase | ||
{ | ||
/** {@inheritDoc} */ | ||
protected function defineWebRoutes($router) | ||
{ | ||
$router->get('decode', fn (Request $request) => [ | ||
'url' => $request->fullUrl(), | ||
'query' => $request->query(), | ||
]); | ||
} | ||
|
||
public function test_it_can_use_uri_to_make_request() | ||
{ | ||
$this->getJson(Uri::of('decode')->withQuery(['editing' => true, 'editMode' => 'create', 'search' => 'Laravel'])) | ||
->assertSuccessful() | ||
->assertJson([ | ||
'url' => 'http://localhost/decode?editMode=create&editing=1&search=Laravel', | ||
'query' => [ | ||
'editing' => '1', | ||
'editMode' => 'create', | ||
'search' => 'Laravel', | ||
], | ||
]); | ||
} | ||
} |