Skip to content

Commit

Permalink
Adds hasText() method.
Browse files Browse the repository at this point in the history
  • Loading branch information
mvdnbrk committed Jun 16, 2019
1 parent eaf6ea4 commit f106685
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 @@ -59,6 +59,7 @@ $feed->reviews->each(function ($review) {
$review->recommendation;
$review->hasHeadline();
$review->headline;
$review->hasText();
$review->text;
$review->createdAt;
$review->updatedAt;
Expand Down
10 changes: 10 additions & 0 deletions src/Resources/Review.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,16 @@ public function hasHeadline()
return ! empty($this->headline);
}

/**
* Determine if the review has a headline.
*
* @return bool
*/
public function hasText()
{
return ! empty($this->text);
}

/**
* Alias "dateSince" to the "created_at" attribute.
*
Expand Down
12 changes: 12 additions & 0 deletions tests/Unit/ReviewResourceTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,18 @@ public function it_can_determine_if_it_has_a_headline()
$this->assertTrue($review->hasHeadline());
}

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

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

$review->text = 'Lorem.';

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

/** @test */
public function converting_to_an_array()
{
Expand Down

0 comments on commit f106685

Please sign in to comment.