1: <?php
2:
3: namespace AlexisLefebvre\Bundle\AsyncTweetsBundle\Command;
4:
5: use Symfony\Component\Console\Input\InputArgument;
6: use Symfony\Component\Console\Input\InputInterface;
7:
8: class StatusesHomeTimelineTestCommand extends StatusesHomeTimelineCommand
9: {
10: protected function configure()
11: {
12: parent::configure();
13:
14: $this
15: ->setName('statuses:hometimelinetest')
16: ->setDescription('Fetch home timeline test')
17: ->addArgument(
18: 'test',
19: InputArgument::OPTIONAL,
20: 'Return data for tests'
21: );
22: }
23:
24: 25: 26: 27: 28: 29: 30:
31: protected function getTestContent($filename)
32: {
33:
34: return json_decode(file_get_contents(
35: $this->container->get('kernel')->locateResource(
36: '@AsyncTweetsBundle/Tests/Command/data/'.$filename
37: )
38: ));
39: }
40:
41: 42: 43: 44: 45:
46: protected function getContent(InputInterface $input)
47: {
48: switch ($input->getArgument('test')) {
49: case 'json':
50: return $this->getTestContent(
51: 'tweets_32_bits.json');
52: case 'json_with_retweet':
53: return $this->getTestContent(
54: 'tweet_with_retweet.json');
55: case 'not_array':
56:
57: return;
58: case 'empty_array':
59:
60: return [];
61: default:
62:
63: return parent::getContent($input);
64: }
65: }
66: }
67: