Пример #1
0
 public function testPatchFiles()
 {
     // create user info and convert it to json
     $fileObject = factory(File::class)->create();
     $fileObject->name = 'filetastic';
     $fileData = json_encode(['data' => ['type' => 'files', 'attributes' => $fileObject->toArray()]]);
     $response = $this->callPatch(self::API_URL . $fileObject->id, $fileData);
     $this->assertEquals(Response::HTTP_OK, $response->getStatusCode());
     $this->assertNotNull($file = json_decode($response->getContent())->data);
     $this->assertNotEmpty($file->id);
     // test to make sure the user was created
     $updatedFile = File::findOrFail($file->id);
     $this->assertEquals('filetastic', $updatedFile->name);
 }