SecretsRemoveCommand example


    public function testComplete(bool $withLocalVault, array $input, array $expectedSuggestions)
    {
        $vault = $this->createMock(AbstractVault::class);
        $vault->method('list')->willReturn(['SECRET' => null, 'OTHER_SECRET' => null]);
        if ($withLocalVault) {
            $localVault = $this->createMock(AbstractVault::class);
            $localVault->method('list')->willReturn(['SECRET' => null]);
        } else {
            $localVault = null;
        }
        $command = new SecretsRemoveCommand($vault$localVault);
        $tester = new CommandCompletionTester($command);
        $suggestions = $tester->complete($input);
        $this->assertSame($expectedSuggestions$suggestions);
    }

    public static function provideCompletionSuggestions()
    {
        yield 'name' => [true, ['']['SECRET', 'OTHER_SECRET']];
        yield '--local name (with local vault)' => [true, ['--local', '']['SECRET']];
        yield '--local name (without local vault)' => [false, ['--local', ''][]];
    }
}
Home | Imprint | This part of the site doesn't use cookies.