/**
  * @return Post
  *
  * @SuppressWarnings(PHPMD.StaticAccess)
  */
 private function getRandomPost()
 {
     if ($this->posts === null) {
         $this->posts = Post::all();
     }
     return $this->posts->random();
 }
 /**
  * @return void
  */
 public function testUpdateByAnonymousUnauthorized()
 {
     /** @var Model $post */
     $this->assertNotNull($post = Model::first());
     $this->beginDatabaseTransaction();
     $idx = $post->getKey();
     $body = $this->getUpdateRequestBody($idx);
     /** @var Response $response */
     $response = $this->callPatch(null, $idx, $body);
     $this->assertEquals(Response::HTTP_FORBIDDEN, $response->getStatusCode());
 }