Skip to content

Commit

Permalink
Adds hasNegativeComment().
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdnbrk committed Feb 8, 2019
1 parent 1496b29 commit 5f8b77e
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ $feed->reviews->each(function ($review) {

$review->hasPositiveComment();
$review->positiveComment;
$review->hasNegativeComment();
$review->negativeComment;

$review->createdAt;
Expand Down
10 changes: 10 additions & 0 deletions src/Resources/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,16 @@ public function hasPositiveComment()
return ! empty($this->comment_positive);
}

/**
* Determine if the review has a positive comment.
*
* @return bool
*/
public function hasNegativeComment()
{
return ! empty($this->comment_negative);
}

/**
* Set the id for this review.
*
Expand Down
12 changes: 12 additions & 0 deletions tests/Unit/ReviewTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,4 +70,16 @@ public function it_can_determine_if_it_has_a_positive_comment()

$this->assertTrue($review->hasPositiveComment());
}

/** @test */
public function it_can_determine_if_it_has_a_negative_comment()
{
$review = new Review();

$this->assertFalse($review->hasNegativeComment());

$review->comment_negative = 'Some negative comment';

$this->assertTrue($review->hasNegativeComment());
}
}

0 comments on commit 5f8b77e

Please sign in to comment.