Skip to content

Commit

Permalink
Asserts that the authenticated user is logged
Browse files Browse the repository at this point in the history
  • Loading branch information
artstorm committed Sep 7, 2015
1 parent 68c1274 commit 8d8d1b2
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions api/tests/integration/ArticleTest.php
Expand Up @@ -608,6 +608,8 @@ public function testShouldNotPostCommentWithoutAuthedUserForArticle()

public function testShouldLogPutMetas()
{
$user = $this->createUser(['user_type' => 'guest']);
$token = $this->tokenFromUser($user);
$article = factory(Article::class)->create();

$metas = factory(\App\Models\ArticleMeta::class, 2)->make();
Expand All @@ -616,10 +618,13 @@ public function testShouldLogPutMetas()
array_push($entities, $this->prepareEntity($meta));
}

$this->putJson('/articles/'.$article->article_id.'/meta', $entities);
$this->putJson('/articles/'.$article->article_id.'/meta', $entities, [
'HTTP_AUTHORIZATION' => 'Bearer '.$token,
]);

$article = Article::find($article->article_id);
$this->assertCount(2, $article->revisionHistory->toArray());
$this->assertCount(2, $revisions = $article->revisionHistory->toArray());
$this->assertEquals($user->user_id, reset($revisions)['user_id']);

$this->cleanupDiscussions([$article]);
}
Expand Down

0 comments on commit 8d8d1b2

Please sign in to comment.