Thanks to visit codestin.com
Credit goes to github.com

Skip to content
This repository was archived by the owner on Dec 14, 2024. It is now read-only.

Commit 0ac900c

Browse files
Merge f261206 into 8d45bb0
2 parents 8d45bb0 + f261206 commit 0ac900c

6 files changed

Lines changed: 75 additions & 3 deletions

File tree

.scrutinizer.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -27,6 +27,8 @@ build:
2727
idle_timeout: 900
2828
tests:
2929
override:
30+
-
31+
command: './vendor/bin/phpspec run --format=pretty'
3032
-
3133
command: './vendor/bin/phpunit --coverage-clover=coverage-clover'
3234
coverage:

.travis.yml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ cache:
1313
php:
1414
- 5.6
1515
- 7.0
16-
- hhvm
16+
- 7.1
1717

1818
env:
1919
- SYMFONY_VERSION="2.8.*"
@@ -37,7 +37,10 @@ install:
3737
- composer require --dev symfony/symfony:${SYMFONY_VERSION} $DEPENDENCY --no-update
3838
- composer install --no-interaction --profile --no-progress
3939

40-
script: php ./vendor/bin/phpunit $PHPUNIT_FLAGS && php ./vendor/bin/behat
40+
script:
41+
- php ./vendor/bin/phpspec run --format=pretty
42+
- php ./vendor/bin/phpunit $PHPUNIT_FLAGS
43+
- php ./vendor/bin/behat
4144

4245
# Only send code coverage if it has been generated
4346
after_success:

appveyor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,7 @@ install:
4343

4444
test_script:
4545
- cd c:\projects\asynctweetsbundle
46+
- vendor/bin/phpspec run --format=pretty || SET X=!errorlevel!
4647
- vendor/bin/phpunit --colors=never || SET X=!errorlevel!
4748
- vendor/bin/behat || SET X=!errorlevel!
4849
- exit %X%

circle.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,6 @@ dependencies:
1313
test:
1414
override:
1515
- mkdir -p $CIRCLE_TEST_REPORTS/phpunit
16+
- php ./vendor/bin/phpspec run --format=pretty
1617
- php ./vendor/bin/phpunit --log-junit $CIRCLE_TEST_REPORTS/phpunit/junit.xml
1718
- php ./vendor/bin/behat

composer.json

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,8 @@
2828
"behat/symfony2-extension": "^2.1",
2929
"behat/mink": "^1.7",
3030
"behat/mink-extension": "^2.2",
31-
"behat/mink-browserkit-driver": "^1.3"
31+
"behat/mink-browserkit-driver": "^1.3",
32+
"phpspec/phpspec": "~3.4"
3233
},
3334
"autoload" : {
3435
"psr-4" : {
Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?php
2+
3+
namespace spec\AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity;
4+
5+
use AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity\Tweet;
6+
use PhpSpec\Exception\Example\SkippingException;
7+
use PhpSpec\ObjectBehavior;
8+
9+
class TweetSpec extends ObjectBehavior
10+
{
11+
public function let(Tweet $tweet)
12+
{
13+
$this->beConstructedWith($tweet);
14+
15+
$fakeTweet = new \stdClass();
16+
$fakeTweet->created_at = 'now';
17+
$fakeTweet->text = 'Hello Twitter! #myfirstTweet';
18+
$fakeTweet->retweet_count = 5;
19+
$fakeTweet->favorite_count = 12;
20+
21+
$this->setValues($fakeTweet);
22+
}
23+
24+
public function it_is_initializable()
25+
{
26+
$this->shouldHaveType(Tweet::class);
27+
}
28+
29+
public function it_should_have_a_created_at_datetime()
30+
{
31+
$this->getCreatedAt()->shouldHaveType(new \DateTime());
32+
}
33+
34+
public function it_should_have_the_title()
35+
{
36+
$this->getText()->shouldBeEqualTo('Hello Twitter! #myfirstTweet');
37+
}
38+
39+
public function it_should_have_retweet_count()
40+
{
41+
$this->getRetweetCount()->shouldBeEqualTo(5);
42+
}
43+
44+
public function it_should_have_favorite_count()
45+
{
46+
$this->getFavoriteCount()->shouldBeEqualTo(12);
47+
}
48+
49+
public function it_should_not_be_in_timeline()
50+
{
51+
$this->shouldNotBeInTimeline();
52+
}
53+
54+
public function it_should_not_allow_invalid_medias()
55+
{
56+
/* @see https://github.com/phpspec/phpspec/issues/119#issuecomment-43436579 */
57+
if (version_compare(PHP_VERSION, '7', '<')) {
58+
throw new SkippingException('Unsupported type hinting with PHP < 7');
59+
}
60+
61+
$this->shouldThrow('\TypeError')->during('addMedia', [null]);
62+
$this->shouldThrow('\TypeError')->during('removeMedia', [null]);
63+
}
64+
}

0 commit comments

Comments
 (0)