-
Notifications
You must be signed in to change notification settings - Fork 0
/
StatusesReadTest.php
81 lines (61 loc) · 2.36 KB
/
StatusesReadTest.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
<?php
namespace Acme\Command;
use AlexisLefebvre\Bundle\AsyncTweetsBundle\Command\StatusesReadCommand;
use Liip\TestFixturesBundle\Test\FixturesTrait;
use Symfony\Component\Console\Tester\CommandTester;
class StatusesReadTest extends StatusesBase
{
use FixturesTrait;
/** @var CommandTester */
public $commandTester;
public function setUp(): void
{
parent::setUp();
$this->application->add(new StatusesReadCommand());
$command = $this->application->find('statuses:read');
$this->commandTester = new CommandTester($command);
}
public function testStatusesReadEmpty()
{
$this->loadFixtures([]);
// Disable decoration for tests on Windows
$options = [];
// http://stackoverflow.com/questions/5879043/php-script-detect-whether-running-under-linux-or-windows/5879078#5879078
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
// https://tracker.phpbb.com/browse/PHPBB3-12752
$options['decorated'] = false;
}
$this->commandTester->execute([], $options);
$this->assertStringContainsString('Current page: 1', $this->commandTester->getDisplay());
}
public function testStatusesReadWithTweets()
{
$this->loadFixtures([
'Acme\DataFixtures\ORM\LoadTweetData',
]);
// Disable decoration for tests on Windows
$options = [];
// http://stackoverflow.com/questions/5879043/php-script-detect-whether-running-under-linux-or-windows/5879078#5879078
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
// https://tracker.phpbb.com/browse/PHPBB3-12752
$options['decorated'] = false;
}
$this->commandTester->execute([], $options);
$display = $this->commandTester->getDisplay();
$this->assertStringContainsString('Current page: 1', $display);
// Test the first line of the table
$this->assertStringContainsString(
'| Asynchronous | '.
'Hello Twitter! #myfirstTweet | '.
'2015-02-10 21:19 |',
$display
);
// Test the retweet
$this->assertStringContainsString(
'| GitHub | '.
'RT @GitHubEng: Cross-platform UI in | '.
'2015-08-20 17:00 |',
$display
);
}
}