コード例 #1
0
 /**
  * @return void
  */
 public function testUpdateByOwner()
 {
     $user = $this->user();
     /** @var Model $post */
     $this->assertNotNull($post = $user->{User::REL_POSTS}->first());
     $this->beginDatabaseTransaction();
     $idx = $post->getKey();
     $body = $this->getUpdateRequestBody($idx);
     /** @var Response $response */
     $response = $this->callPatch($user, $idx, $body);
     $this->assertResponseOk();
     $this->assertNotEmpty($resource = json_decode($response->getContent())->data);
     $this->assertNotNull($model = Model::find($resource->id));
     $this->assertEquals('New title', $model->{Model::FIELD_TITLE});
 }