-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
e410d70
commit 1a176c3
Showing
13 changed files
with
77 additions
and
90 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
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
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
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
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
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
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
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 |
---|---|---|
|
@@ -32,15 +32,14 @@ public function setUp() | |
/** @test */ | ||
public function it_can_be_instantiated() | ||
{ | ||
$user = new User([ | ||
$user = User::query()->create([ | ||
'first_name' => 'John', | ||
'last_name' => 'DOE', | ||
'email' => '[email protected]', | ||
]); | ||
$user->save(); | ||
|
||
$this->assertJson($content = UserResource::make($user)->response()->content()); | ||
$this->assertSame([ | ||
static::assertJson($content = UserResource::make($user)->response()->content()); | ||
static::assertSame([ | ||
'data' => [ | ||
'hashed_id' => 'hashed_id_here', | ||
'full_name' => 'John DOE', | ||
|
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 |
---|---|---|
@@ -1,6 +1,5 @@ | ||
<?php namespace Arcanedev\LaravelApiHelper\Tests\Http; | ||
|
||
use Arcanedev\LaravelApiHelper\Http\FormRequest; | ||
use Arcanedev\LaravelApiHelper\Tests\TestCase; | ||
|
||
/** | ||
|
@@ -19,14 +18,13 @@ class FormRequestTest extends TestCase | |
/** @test */ | ||
public function it_can_fail_validation_with_form_request() | ||
{ | ||
$response = $this->json('POST', 'form-request')->response; | ||
$response = $this->json('POST', 'form-request'); | ||
|
||
$this->assertFalse($response->isOk()); | ||
$this->assertSame(422, $response->status()); | ||
$response->assertStatus(422); | ||
|
||
$this->assertJson($content = $response->content()); | ||
static::assertJson($content = $response->content()); | ||
|
||
$this->assertSame([ | ||
static::assertSame([ | ||
'message' => 'The given data was invalid.', | ||
'errors' => [ | ||
'name' => [ | ||
|
@@ -45,16 +43,15 @@ public function it_can_validate_form_request() | |
$response = $this->json('POST', 'form-request', [ | ||
'name' => 'ARCANEDEV', | ||
'email' => '[email protected]', | ||
])->response; | ||
]); | ||
|
||
$this->assertTrue($response->isOk()); | ||
$this->assertSame(200, $response->status()); | ||
$response->assertSuccessful(); | ||
|
||
$this->assertJson($response->content()); | ||
$this->assertJson($content = $response->content()); | ||
$this->assertSame(json_encode([ | ||
'status' => 200, | ||
'code' => 'success', | ||
'message' => 'Everything is good !', | ||
]), $response->content()); | ||
]), $content); | ||
} | ||
} |
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
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
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
Oops, something went wrong.