-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
8d45bb0
commit c14ad54
Showing
6 changed files
with
68 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
spec/AlexisLefebvre/Bundle/AsyncTweetsBundle/Entity/TweetSpec.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
<?php | ||
|
||
namespace spec\AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity; | ||
|
||
use AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity\Tweet; | ||
use PhpSpec\ObjectBehavior; | ||
|
||
class TweetSpec extends ObjectBehavior | ||
{ | ||
public function let(Tweet $tweet) | ||
{ | ||
$this->beConstructedWith($tweet); | ||
|
||
$fakeTweet = new \stdClass(); | ||
$fakeTweet->created_at = 'now'; | ||
$fakeTweet->text = 'Hello Twitter! #myfirstTweet'; | ||
$fakeTweet->retweet_count = 5; | ||
$fakeTweet->favorite_count = 12; | ||
|
||
$this->setValues($fakeTweet); | ||
} | ||
|
||
public function it_is_initializable() | ||
{ | ||
$this->shouldHaveType(Tweet::class); | ||
} | ||
|
||
public function it_should_have_a_created_at_datetime() | ||
{ | ||
$this->getCreatedAt()->shouldHaveType(new \DateTime); | ||
} | ||
|
||
public function it_should_have_the_title() | ||
{ | ||
$this->getText()->shouldBeEqualTo('Hello Twitter! #myfirstTweet'); | ||
} | ||
|
||
public function it_should_have_retweet_count() | ||
{ | ||
$this->getRetweetCount()->shouldBeEqualTo(5); | ||
} | ||
|
||
public function it_should_have_favorite_count() | ||
{ | ||
$this->getFavoriteCount()->shouldBeEqualTo(12); | ||
} | ||
|
||
public function it_should_not_be_in_timeline() | ||
{ | ||
$this->shouldNotBeInTimeline(); | ||
} | ||
|
||
public function it_should_not_allow_invalid_medias() | ||
{ | ||
$this->shouldThrow('\TypeError')->during('addMedia', [null]); | ||
$this->shouldThrow('\TypeError')->during('removeMedia', [null]); | ||
} | ||
} |