/**
  * @test
  */
 public function should_update_existing_article_and_respond_without_instance()
 {
     $responseMock = $this->createResponseMock(200, null);
     $apiClient = $this->createTestApiClient($responseMock);
     $article = new Article();
     $article->setId(uniqid());
     $article->setCollectionId(uniqid());
     $article->setName(uniqid("New Article Name "));
     $article->setText("New Article text");
     $updated = $apiClient->updateArticle($article, false);
     $this->assertSame($article, $updated);
 }
 /**
  * @param Article $article
  * @param bool $reload
  * @return Article
  * @throws ApiException
  */
 public function updateArticle(Article $article, $reload = false)
 {
     $url = sprintf("articles/%s", $article->getId());
     $requestBody = $article->toArray();
     if ($reload) {
         $requestBody['reload'] = true;
     }
     $response = $this->doPut($url, $requestBody);
     if ($reload) {
         $articleData = (array) $response;
         $articleData = reset($articleData);
         return new Article($articleData);
     } else {
         return $article;
     }
 }