|
| 1 | +<?php |
| 2 | + |
| 3 | +namespace Keboola\DynamoDbExtractor; |
| 4 | + |
| 5 | +use Symfony\Component\Console\Application; |
| 6 | +use Symfony\Component\Console\Tester\CommandTester; |
| 7 | + |
| 8 | +class RunFullExportUnknownTableTest extends ExtractorTestCase |
| 9 | +{ |
| 10 | + /** @var string */ |
| 11 | + protected $dataDir = '/tmp/run-unknown-table'; |
| 12 | + |
| 13 | + protected function setUp() |
| 14 | + { |
| 15 | + parent::setUp(); |
| 16 | + |
| 17 | + $this->fs->dumpFile($this->dataDir . '/config.json', <<<JSON |
| 18 | +{ |
| 19 | + "parameters": { |
| 20 | + "db": { |
| 21 | + "endpoint": "http://dynamodb:8000", |
| 22 | + "accessKeyId": "key", |
| 23 | + "#secretAccessKey": "secret", |
| 24 | + "regionName": "eu-central-1" |
| 25 | + }, |
| 26 | + "exports": [ |
| 27 | + { |
| 28 | + "id": 1, |
| 29 | + "name": "10-movies", |
| 30 | + "table": "RandomTable", |
| 31 | + "enabled": true, |
| 32 | + "incremental": true, |
| 33 | + "mapping": { |
| 34 | + "title": "title", |
| 35 | + "year": "year", |
| 36 | + "info.rating": "rating" |
| 37 | + } |
| 38 | + } |
| 39 | + ] |
| 40 | + } |
| 41 | +} |
| 42 | +JSON |
| 43 | + ); |
| 44 | + } |
| 45 | + |
| 46 | + public function testRun() |
| 47 | + { |
| 48 | + $application = new Application; |
| 49 | + $application->add(new RunCommand); |
| 50 | + |
| 51 | + $command = $application->find('run'); |
| 52 | + $commandTester = new CommandTester($command); |
| 53 | + |
| 54 | + $exitCode = $commandTester->execute([ |
| 55 | + 'command' => $command->getName(), |
| 56 | + 'data directory' => $this->dataDir, |
| 57 | + ]); |
| 58 | + |
| 59 | + $this->assertSame(1, $exitCode); |
| 60 | + $this->assertContains( |
| 61 | + 'ResourceNotFoundException', |
| 62 | + $commandTester->getDisplay() |
| 63 | + ); |
| 64 | + } |
| 65 | +} |
0 commit comments