This commit is contained in:
29
tests/CommandBackupTest.php
Normal file
29
tests/CommandBackupTest.php
Normal file
@ -0,0 +1,29 @@
|
||||
<?php
|
||||
namespace App\Tests;
|
||||
|
||||
use PHPUnit\Framework\TestCase;
|
||||
use Symfony\Component\Console\Application;
|
||||
use Symfony\Component\Console\Tester\CommandTester;
|
||||
use App\CommandBackup;
|
||||
|
||||
class CommandBackupTest extends \PHPUnit\Framework\TestCase
|
||||
{
|
||||
public function testExecute()
|
||||
{
|
||||
|
||||
$applicationd = new Application('backup', "1.1.1");
|
||||
|
||||
$applicationd->add(new CommandBackup());
|
||||
|
||||
|
||||
$command = $applicationd->find('backup');
|
||||
$commandTester = new CommandTester($command);
|
||||
$commandTester->execute([]);
|
||||
|
||||
$commandTester->assertCommandIsSuccessful();
|
||||
|
||||
// the output of the command in the console
|
||||
$output = $commandTester->getDisplay();
|
||||
$this->assertStringContainsString('backup', $output);
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user