
| Current Path : /var/www/html_old/12park.007/vendor/consolidation/site-process/tests/ |
Linux ift1.ift-informatik.de 5.4.0-216-generic #236-Ubuntu SMP Fri Apr 11 19:53:21 UTC 2025 x86_64 |
| Current File : /var/www/html_old/12park.007/vendor/consolidation/site-process/tests/ArgumentProcessorTest.php |
<?php
namespace Consolidation\SiteProcess;
use PHPUnit\Framework\TestCase;
use Consolidation\SiteProcess\Util\ArgumentProcessor;
use Consolidation\SiteAlias\SiteAlias;
class ArgumentProcessorTest extends TestCase
{
/**
* Data provider for testArgumentProcessor.
*/
public function argumentProcessorTestValues()
{
return [
[
'["ls", "-al"]',
[],
['ls', '-al'],
[],
[],
],
[
'["drush", "status", "--fields=root,uri"]',
[],
['drush', 'status'],
['fields' => 'root,uri'],
[],
],
[
'["drush", "rsync", "a", "b", "--", "--exclude=vendor"]',
[],
['drush', 'rsync', 'a', 'b',],
[],
['exclude' => 'vendor'],
],
[
'["drush", "rsync", "a", "b", "--", "--exclude=vendor", "--include=vendor/autoload.php"]',
[],
['drush', 'rsync', 'a', 'b', '--', '--include=vendor/autoload.php'],
[],
['exclude' => 'vendor'],
],
];
}
/**
* Test the SiteProcess class.
*
* @dataProvider argumentProcessorTestValues
*/
public function testArgumentProcessor(
$expected,
$siteAliasData,
$args,
$options,
$optionsPassedAsArgs)
{
$siteAlias = new SiteAlias($siteAliasData, '@alias.dev');
$processor = new ArgumentProcessor();
$actual = $processor->selectArgs($siteAlias, $args, $options, $optionsPassedAsArgs);
$actual = '["' . implode('", "', $actual) . '"]';
$this->assertEquals($expected, $actual);
}
}