10 use Symfony\Component\Console\Tester\CommandTester;
14 public function testExecute()
16 $table = $this->createMock(\Symfony\Component\Console\Helper\Table::class);
17 $table->expects($this->once())->method(
'setHeaders')->with([
'Backup Filename',
'Backup Type']);
18 $table->expects($this->once())->method(
'addRow')->with([
'backupFile_media.tgz',
'media']);
20 $tableFactoryMock = $this->createMock(\Symfony\Component\Console\Helper\TableFactory::class);
21 $tableFactoryMock->expects($this->once())->method(
'create')->will($this->returnValue(
$table));
28 $file->expects($this->once())->method(
'isExists')->will($this->returnValue(
true));
29 $file->expects($this->once())
30 ->method(
'readDirectoryRecursively')
31 ->will($this->returnValue([
'backupFile_media.tgz']));
33 $commandTester =
new CommandTester($command);
34 $commandTester->execute([]);
35 $expected =
'Showing backup files in ';
36 $this->assertStringStartsWith($expected, $commandTester->getDisplay());