All checks were successful
		
		
	
	ci/woodpecker/push/woodpecker Pipeline was successful
				
			
		
			
				
	
	
		
			45 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
			
		
		
	
	
			45 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			PHP
		
	
	
	
	
	
<?php 
 | 
						|
use PHPUnit\Framework\TestCase;
 | 
						|
use Symfony\Component\Console\Application;
 | 
						|
use Symfony\Component\Console\Tester\CommandTester;
 | 
						|
use App\CommandShow;
 | 
						|
 | 
						|
class CommandShowTest extends \PHPUnit\Framework\TestCase
 | 
						|
{
 | 
						|
    public function testInvalidConfig()
 | 
						|
    {
 | 
						|
 | 
						|
        $applicationd = new Application('backup', "1.1.1");
 | 
						|
 | 
						|
        $applicationd->add(new CommandShow());
 | 
						|
 | 
						|
 | 
						|
        $command = $applicationd->find('show');
 | 
						|
        $commandTester = new CommandTester($command);
 | 
						|
        $commandTester->execute(['config'=>"bad_file"]);
 | 
						|
 | 
						|
        $output = $commandTester->getDisplay();
 | 
						|
        $this->assertStringContainsString('[ERROR] Configuration error: File "bad_file" does not exist.', $output);
 | 
						|
    }
 | 
						|
 | 
						|
    public function testGoodConfig()
 | 
						|
    {
 | 
						|
        exec('rclone test makefiles temp/source 2>&1');
 | 
						|
        
 | 
						|
        $applicationd = new Application('backup', "1.1.1");
 | 
						|
 | 
						|
        $applicationd->add(new CommandShow());
 | 
						|
 | 
						|
 | 
						|
        $command = $applicationd->find('show');
 | 
						|
        $commandTester = new CommandTester($command);
 | 
						|
        $commandTester->execute(['config'=>"config.example.yml"]);
 | 
						|
 | 
						|
        $output = $commandTester->getDisplay();
 | 
						|
        $this->assertStringContainsString('Example', $output);
 | 
						|
        $this->assertStringContainsString('temp/source', $output);
 | 
						|
        $this->assertStringContainsString('temp/destination', $output);
 | 
						|
    }
 | 
						|
 | 
						|
 | 
						|
} |