Created
October 19, 2016 21:24
-
-
Save Cayan/f1d997bcd5c1a63b3129fa843a804f0d to your computer and use it in GitHub Desktop.
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
<?php | |
use Illuminate\Foundation\Testing\DatabaseMigrations; | |
use Illuminate\Foundation\Testing\DatabaseTransactions; | |
class UserCRUDFailureTest extends TestCase | |
{ | |
use DatabaseMigrations, DatabaseTransactions; | |
protected $prefix = ''; | |
protected function setUp() | |
{ | |
parent::setUp(); | |
factory(App\User::class)->create(); | |
factory(App\User::class)->create(); | |
} | |
public function testRead() | |
{ | |
$response = $this->call('GET', $this->prefix . '/3'); | |
$actual = $response->getStatusCode(); | |
$expected = \Illuminate\Http\Response::HTTP_UNPROCESSABLE_ENTITY; | |
$this->assertEquals($expected, $actual); | |
} | |
public function testUpdate() | |
{ | |
$newName = 'Daniel Pinto'; | |
$response = $this->call('PUT', $this->prefix . '/', [ | |
'id' => 3, | |
'name' => $newName | |
], [], [], $this->transformHeadersToServerVars([ | |
'Accept' => 'application/json', | |
'CONTENT_TYPE' => 'x-www-form-urlencoded' | |
])); | |
$actual = $response->getStatusCode(); | |
$expected = \Illuminate\Http\Response::HTTP_UNPROCESSABLE_ENTITY; | |
$this->assertEquals($expected, $actual); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment