mirror of
https://github.com/symfony/framework-bundle.git
synced 2026-03-24 01:12:20 +01:00
* 7.3: fix merge do not use PHPUnit mock objects without configured expectations do not use PHPUnit mock objects without configured expectations Typo [HttpClient] Fix and test replacing repeated headers with CachingHttpClient [Messenger] Fix processing batches do not use PHPUnit mock objects without configured expectations do not use PHPUnit mock objects without configured expectations
40 lines
1.4 KiB
PHP
40 lines
1.4 KiB
PHP
<?php
|
|
|
|
/*
|
|
* This file is part of the Symfony package.
|
|
*
|
|
* (c) Fabien Potencier <fabien@symfony.com>
|
|
*
|
|
* For the full copyright and license information, please view the LICENSE
|
|
* file that was distributed with this source code.
|
|
*/
|
|
|
|
namespace Symfony\Bundle\FrameworkBundle\Tests\Command;
|
|
|
|
use PHPUnit\Framework\Attributes\DataProvider;
|
|
use PHPUnit\Framework\TestCase;
|
|
use Symfony\Bundle\FrameworkBundle\Command\SecretsSetCommand;
|
|
use Symfony\Bundle\FrameworkBundle\Secrets\AbstractVault;
|
|
use Symfony\Component\Console\Tester\CommandCompletionTester;
|
|
|
|
class SecretsSetCommandTest extends TestCase
|
|
{
|
|
#[DataProvider('provideCompletionSuggestions')]
|
|
public function testComplete(array $input, array $expectedSuggestions)
|
|
{
|
|
$vault = $this->createStub(AbstractVault::class);
|
|
$vault->method('list')->willReturn(['SECRET' => null, 'OTHER_SECRET' => null]);
|
|
$localVault = $this->createStub(AbstractVault::class);
|
|
$command = new SecretsSetCommand($vault, $localVault);
|
|
$tester = new CommandCompletionTester($command);
|
|
$suggestions = $tester->complete($input);
|
|
$this->assertSame($expectedSuggestions, $suggestions);
|
|
}
|
|
|
|
public static function provideCompletionSuggestions(): iterable
|
|
{
|
|
yield 'name' => [[''], ['SECRET', 'OTHER_SECRET']];
|
|
yield '--local name (with local vault)' => [['--local', ''], ['SECRET', 'OTHER_SECRET']];
|
|
}
|
|
}
|