createCommandCompletionTester example

use Symfony\Component\DependencyInjection\ServiceLocator;
use Symfony\Component\EventDispatcher\EventDispatcher;
use Symfony\Component\Mailer\Event\MessageEvent;

class EventDispatcherDebugCommandTest extends TestCase
{
    /** * @dataProvider provideCompletionSuggestions */
    public function testComplete(array $input, array $expectedSuggestions)
    {
        $tester = $this->createCommandCompletionTester();

        $suggestions = $tester->complete($input);

        $this->assertSame($expectedSuggestions$suggestions);
    }

    public static function provideCompletionSuggestions()
    {
        yield 'event' => [[''][MessageEvent::class, 'console.command']];
        yield 'event for other dispatcher' => [['--dispatcher', 'other_event_dispatcher', '']['other_event', 'App\OtherEvent']];
        yield 'dispatcher' => [['--dispatcher=']['event_dispatcher', 'other_event_dispatcher']];
        
class TranslationUpdateCommandCompletionTest extends TestCase
{
    private Filesystem $fs;
    private string $translationDir;

    /** * @dataProvider provideCompletionSuggestions */
    public function testComplete(array $input, array $expectedSuggestions)
    {
        $tester = $this->createCommandCompletionTester(['messages' => ['foo' => 'foo']]);

        $suggestions = $tester->complete($input);

        $this->assertSame($expectedSuggestions$suggestions);
    }

    public static function provideCompletionSuggestions()
    {
        $bundle = new ExtensionPresentBundle();

        yield 'locale' => [['']['en', 'fr']];
        
Home | Imprint | This part of the site doesn't use cookies.