diff --git a/src/Command/BpnXmlSyncCommand.php b/src/Command/BpnXmlSyncCommand.php index c59bee3..3b257be 100644 --- a/src/Command/BpnXmlSyncCommand.php +++ b/src/Command/BpnXmlSyncCommand.php @@ -76,19 +76,11 @@ class BpnXmlSyncCommand extends Command return Command::SUCCESS; } - $io->text(sprintf( - 'Remote: %s (%d files)', - $remoteInfo->lastTransfer->format('d.m.Y H:i:s'), - $remoteInfo->fileCount - )); + $io->text($this->formatInfoLine('Remote', $remoteInfo, $output)); $localInfo = $this->readLocalInfo(); if (null !== $localInfo) { - $io->text(sprintf( - 'Local: %s (%d files)', - $localInfo->lastTransfer->format('d.m.Y H:i:s'), - $localInfo->fileCount - )); + $io->text($this->formatInfoLine('Local', $localInfo, $output)); } else { $io->text('Local: no data'); } @@ -245,4 +237,18 @@ class BpnXmlSyncCommand extends Command $this->cache->delete($key); } } + + private function formatInfoLine(string $label, XmlExportInfo $info, OutputInterface $output): string + { + if ($output->isVerbose()) { + return sprintf( + '%s: %s (%d files)', + $label, + $info->lastTransfer->format('d.m.Y H:i:s'), + $info->fileCount + ); + } + + return sprintf('%s: %d files', $label, $info->fileCount); + } } diff --git a/tests/Command/BpnXmlSyncCommandTest.php b/tests/Command/BpnXmlSyncCommandTest.php index e5f294d..2b13930 100644 --- a/tests/Command/BpnXmlSyncCommandTest.php +++ b/tests/Command/BpnXmlSyncCommandTest.php @@ -91,7 +91,6 @@ class BpnXmlSyncCommandTest extends TestCase $tester->execute([]); $this->assertSame(Command::SUCCESS, $tester->getStatusCode()); - $this->assertStringContainsString('snapshots: 2 processed, 0 failed', $tester->getDisplay()); } /**