Skip to content

Commit

Permalink
Merge pull request #87 from alexislefebvre/analysis-1bx2x5
Browse files Browse the repository at this point in the history
Apply fixes from StyleCI
  • Loading branch information
alexislefebvre committed Jul 3, 2020
2 parents c2c60ed + 3c42084 commit 83ec372
Show file tree
Hide file tree
Showing 6 changed files with 50 additions and 28 deletions.
2 changes: 1 addition & 1 deletion tests/Command/StatusesHomeTimelineTest.php
Expand Up @@ -13,7 +13,7 @@ class StatusesHomeTimelineTest extends StatusesBase
{
use FixturesTrait;

/** @var CommandTester $commandTester */
/** @var CommandTester */
public $commandTester;

public function setUp(): void
Expand Down
6 changes: 4 additions & 2 deletions tests/Command/StatusesHomeTimelineTestCommand.php
Expand Up @@ -46,10 +46,12 @@ protected function getContent(InputInterface $input)
switch ($input->getArgument('test')) {
case 'json':
return $this->getTestContent(
'tweets_32_bits.json');
'tweets_32_bits.json'
);
case 'json_with_retweet':
return $this->getTestContent(
'tweet_with_retweet.json');
'tweet_with_retweet.json'
);
case 'not_array':
// Return null instead of JSON
return;
Expand Down
2 changes: 1 addition & 1 deletion tests/Command/StatusesReadTest.php
Expand Up @@ -10,7 +10,7 @@ class StatusesReadTest extends StatusesBase
{
use FixturesTrait;

/** @var CommandTester $commandTester */
/** @var CommandTester */
public $commandTester;

public function setUp(): void
Expand Down
58 changes: 38 additions & 20 deletions tests/Controller/DefaultControllerTest.php
Expand Up @@ -25,14 +25,18 @@ public function testNoTweets()
$crawler = $this->testClient->request('GET', $path);

// <body>
$this->assertSame(1,
$crawler->filter('html > body')->count());
$this->assertSame(
1,
$crawler->filter('html > body')->count()
);

// Tweet
$this->assertSame(0,
$this->assertSame(
0,
$crawler->filter(
'main.container > div.tweets > div.media > blockquote.media-body'
)->count());
)->count()
);
}

public function testTweets($path = null)
Expand All @@ -52,8 +56,10 @@ public function testTweets($path = null)
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->testClient->getProfile()) {
$this->assertSame(5,
$profile->getCollector('db')->getQueryCount());
$this->assertSame(
5,
$profile->getCollector('db')->getQueryCount()
);
} else {
$this->markTestIncomplete(
'Profiler is disabled.'
Expand Down Expand Up @@ -106,7 +112,8 @@ public function testTweets($path = null)
$this->assertSame(
4,
$crawler->filter(
'blockquote.media-body > p')->count()
'blockquote.media-body > p'
)->count()
);

// User
Expand Down Expand Up @@ -157,8 +164,10 @@ public function testTweetsPages()
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->testClient->getProfile()) {
$this->assertSame(4,
$profile->getCollector('db')->getQueryCount());
$this->assertSame(
4,
$profile->getCollector('db')->getQueryCount()
);
} else {
$this->markTestIncomplete(
'Profiler is disabled.'
Expand All @@ -182,7 +191,8 @@ public function testTweetsPages()
$this->assertSame(
5,
$crawler->filter(
'blockquote.media-body > p')->count()
'blockquote.media-body > p'
)->count()
);

// User
Expand Down Expand Up @@ -211,7 +221,7 @@ public function testTweetsPages()
$crawler->filter(
'main.container > div.tweets > div.media > blockquote.media-body'
)->count()
);
);

// Next page
$crawler = $this->testClient->request('GET', $nextPage);
Expand All @@ -238,7 +248,7 @@ public function testTweetsPages()
$link = $crawler->filter(
'main.container > div.tweets > div.media > '.
'blockquote.media-body > small > a:last-child'
)
)
->eq(4)->link();

$crawler = $this->testClient->click($link);
Expand Down Expand Up @@ -309,8 +319,10 @@ public function testCookie()
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->testClient->getProfile()) {
$this->assertSame(5,
$profile->getCollector('db')->getQueryCount());
$this->assertSame(
5,
$profile->getCollector('db')->getQueryCount()
);
} else {
$this->markTestIncomplete(
'Profiler is disabled.'
Expand Down Expand Up @@ -433,8 +445,10 @@ public function testDeleteTweets()
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->testClient->getProfile()) {
$this->assertSame(4,
$profile->getCollector('db')->getQueryCount());
$this->assertSame(
4,
$profile->getCollector('db')->getQueryCount()
);
} else {
$this->markTestIncomplete(
'Profiler is disabled.'
Expand Down Expand Up @@ -514,9 +528,11 @@ public function testDeleteTweets()
$crawler = $this->testClient->click($link);

// Image
$this->assertSame(1,
$this->assertSame(
1,
$crawler->filter('main.container > div.tweets blockquote.media-body > '.
'p > a > img')->count());
'p > a > img')->count()
);

// Delete the second Tweet in order to remove all the Media

Expand Down Expand Up @@ -650,8 +666,10 @@ public function testHideRetweetedTweets()
$this->assertStatusCode(200, $this->testClient);

if ($profile = $this->testClient->getProfile()) {
$this->assertSame(4,
$profile->getCollector('db')->getQueryCount());
$this->assertSame(
4,
$profile->getCollector('db')->getQueryCount()
);
} else {
$this->markTestIncomplete(
'Profiler is disabled.'
Expand Down
6 changes: 4 additions & 2 deletions tests/DataFixtures/ORM/LoadTweetPagesData.php
Expand Up @@ -22,7 +22,8 @@ public function load(ObjectManager $manager)
->setId($tweetId)
->setUser($this->getReference('user-githubeng'))
->setCreatedAt(new \Datetime(
'2015-02-10 21:18:'.sprintf('%02d', $tweetId)))
'2015-02-10 21:18:'.sprintf('%02d', $tweetId)
))
->setText($tweetId)
->setRetweetCount($tweetId)
->setFavoriteCount($tweetId);
Expand All @@ -36,7 +37,8 @@ public function load(ObjectManager $manager)
->setId($tweetId)
->setUser($this->getReference('user'))
->setCreatedAt(
new \Datetime('2015-02-10 21:19:'.sprintf('%02d', $tweetId)))
new \Datetime('2015-02-10 21:19:'.sprintf('%02d', $tweetId))
)
->setText($tweetId)
->setRetweetCount($tweetId)
->setFavoriteCount($tweetId)
Expand Down
4 changes: 2 additions & 2 deletions tests/Features/Context/FeatureContext.php
Expand Up @@ -7,9 +7,9 @@

class FeatureContext implements Context
{
/** @var $now \Datetime */
/** @var \Datetime */
private $now;
/** @var $tweet \AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity\Tweet */
/** @var \AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity\Tweet */
private $tweet;

/**
Expand Down

0 comments on commit 83ec372

Please sign in to comment.