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

Commit 62ec32c

Browse files
Merge pull request #48 from alexislefebvre/feature/45-allow-280-characters-per-tweet
Feature: Fixes #45: Allow 280 characters per tweet
2 parents 0387279 + bdb01b2 commit 62ec32c

File tree

5 files changed

+40
-9
lines changed

5 files changed

+40
-9
lines changed

DataFixtures/ORM/LoadTweetData.php

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -83,6 +83,21 @@ public function load(ObjectManager $manager)
8383

8484
$manager->persist($tweet);
8585
$manager->flush();
86+
87+
// 280 characters
88+
$tweet = new Tweet();
89+
$tweet
90+
->setId(928032273747795968)
91+
->setUser($this->getReference('user'))
92+
->setCreatedAt(new \Datetime('2017-11-08 21:20:00'))
93+
->setText('In the criminal justice system, sexually based offenses are considered especially heinous. '.
94+
'In New York City, the dedicated detectives who investigate these vicious felonies are members of '.
95+
'an elite squad known as the Special Victims Unit. These are their stories. *DUN DUN*️')
96+
->setRetweetCount(144416)
97+
->setFavoriteCount(256453);
98+
99+
$manager->persist($tweet);
100+
$manager->flush();
86101
}
87102

88103
/**

DataFixtures/ORM/LoadUserData.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function load(ObjectManager $manager)
3838

3939
$this->addReference('user-github', $user);
4040

41-
// Use whose tweet is retweeted
41+
// User whose tweet is retweeted
4242
$user = new User();
4343
$user
4444
->setId(131295561)

Resources/config/doctrine/Tweet.orm.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ AlexisLefebvre\Bundle\AsyncTweetsBundle\Entity\Tweet:
1919
length: null
2020
text:
2121
type: string
22-
length: '255'
22+
length: '280'
2323
retweet_count:
2424
type: integer
2525
length: null

Tests/Command/StatusesHomeTimelineTest.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -255,6 +255,12 @@ public function testStatusesHomeTimelineWithTweetAndRetweet()
255255
);
256256
}
257257

258+
/**
259+
* @requires OS Linux
260+
*
261+
* It returns “last tweet = 928032273747800064” on Windows (AppVeyor),
262+
* this is equal to 928032273747795968+4096, it looks like a bug on Windows.
263+
*/
258264
public function testStatusesHomeTimelineWithSinceIdParameter()
259265
{
260266
$this->loadFixtures([
@@ -264,12 +270,6 @@ public function testStatusesHomeTimelineWithSinceIdParameter()
264270
// Disable decoration for tests on Windows
265271
$options = [];
266272

267-
// http://stackoverflow.com/questions/5879043/php-script-detect-whether-running-under-linux-or-windows/5879078#5879078
268-
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
269-
// https://tracker.phpbb.com/browse/PHPBB3-12752
270-
$options['decorated'] = false;
271-
}
272-
273273
$this->commandTester->execute(
274274
['test' => 'empty_array'],
275275
$options
@@ -278,7 +278,7 @@ public function testStatusesHomeTimelineWithSinceIdParameter()
278278
$display = $this->commandTester->getDisplay();
279279

280280
$this->assertContains(
281-
'last tweet = 1005868490',
281+
'last tweet = 928032273747795968',
282282
$display
283283
);
284284
}

Tests/Entity/TweetRepositoryTest.php

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,4 +49,20 @@ public function testTweetRepository()
4949

5050
$this->assertEquals(3, $tweets);
5151
}
52+
53+
public function testTweetRepositoryWithLongTweet()
54+
{
55+
$this->loadFixtures([
56+
'AlexisLefebvre\Bundle\AsyncTweetsBundle\DataFixtures\ORM\LoadTweetData',
57+
]);
58+
59+
/** @var Tweet $tweet */
60+
$tweet = $this->em
61+
->getRepository('AsyncTweetsBundle:Tweet')
62+
->findOneBy(['id' => 928032273747795968]);
63+
64+
$this->assertNotNull($tweet);
65+
66+
$this->assertSame(275, strlen($tweet->getText()));
67+
}
5268
}

0 commit comments

Comments
 (0)