1
0
Fork 0

Add Global Command tests

pull/11769/head
Franck RANAIVO-HARISOA 2023-12-21 18:13:49 +01:00
parent 8410643e65
commit 514f7087ed
1 changed files with 39 additions and 0 deletions

View File

@ -0,0 +1,39 @@
<?php declare(strict_types=1);
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Test\Command;
use Composer\Test\TestCase;
use Symfony\Component\Console\Command\Command;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Exception\RuntimeException;
class GlobalCommandTest extends TestCase
{
public function testExceptionRunningWithNoSubcommand(): void
{
$this->expectException(RuntimeException::class);
$this->expectExceptionMessage('Not enough arguments (missing: "command-name").');
$appTester = $this->getApplicationTester();
$this->assertEquals(Command::FAILURE, $appTester->run(['command' => 'global']));
}
public function testExceptionRunningWithIncompleteSubcommand(): void
{
$this->expectException(InvalidArgumentException::class);
$this->expectExceptionMessage('Not enough arguments (missing: "packages").');
$appTester = $this->getApplicationTester();
$this->assertEquals(Command::FAILURE, $appTester->run(['command' => 'global', 'command-name' => 'remove'] ));
}
}