MergeYamlCommandTest.php in Database Sanitize 7
File
vendor/edisonlabs/merge-yaml/tests/src/Unit/MergeYamlCommandTest.php
View source
<?php
namespace EdisonLabs\MergeYaml\Unit;
use Composer\Composer;
use EdisonLabs\MergeYaml\MergeYamlCommand;
use PHPUnit\Framework\TestCase;
class MergeYamlCommandTest extends TestCase {
protected $defaultConfig;
protected $inputMock;
protected $outputMock;
protected $packageMock;
protected function setUp() {
$this->defaultConfig = [
'files' => [
'test',
],
'locations' => [
dirname(__FILE__) . '/../../assets',
],
'output-dir' => '/tmp/merge-yaml',
];
$this->inputMock = $this
->getMockBuilder('Symfony\\Component\\Console\\Input\\InputInterface')
->getMock();
$this->outputMock = $this
->getMockBuilder('Symfony\\Component\\Console\\Output\\OutputInterface')
->getMock();
$this->packageMock = $this
->getMockBuilder('Composer\\Package\\RootPackageInterface')
->getMock();
}
protected function tearDown() {
$file = '/tmp/merge-yaml/test.merge.yml';
if (file_exists($file)) {
unlink($file);
}
}
public function testMergeYamlCommand() {
$mergeYamlCommand = new MergeYamlCommand();
$this
->assertEquals('merge-yaml', $mergeYamlCommand
->getName());
$this
->assertEquals('Merge yaml files.', $mergeYamlCommand
->getDescription());
$composer = new Composer();
$composer
->setPackage($this->packageMock);
$mergeYamlCommand
->setComposer($composer);
$mergeYamlCommand
->execute($this->inputMock, $this->outputMock, $this->defaultConfig);
$this
->assertFileExists('/tmp/merge-yaml/test.merge.yml');
}
}