Skip to content

runSymfonyConsoleCommand with options is sometimes ignoring the options #172

@MarkDaleman

Description

@MarkDaleman

Hello 👋

I'm facing a problem when loading migrations from my Module. I want to hook in on the _beforeSuite with a Symfony command to load my fixtures and such.

The interesting thing is, one part works fine while the other part doesn't.

I'm trying to run the following code:

$symfony->runSymfonyConsoleCommand('doctrine:fixtures:load', ['--no-interaction'=>true])

When I print this I get the following rest:

 Careful, database "db_name_here_test" will be purged. Do you want to continue? (yes/no) [no]:\n
 > 

I also run other commands like:

$symfony->runSymfonyConsoleCommand('doctrine:database:drop',['--if-exists'=>true, '--force'=>true]);
$symfony->runSymfonyConsoleCommand('doctrine:database:create');
$symfony->runSymfonyConsoleCommand('doctrine:migrations:migrate', ['--no-interaction'=>true]);

And those work fine (and without user interaction).

So the question is, do I something very wrong or is there a possible bug?

More information

What I've tried is:

  • replacing --no-interaction with --quiet

What kind of software I'm using:

  • Symfony 6.4
  • CodeCeption 5.0.12
  • Module-symfony 3.11

My module's full code for reference:

<?php

namespace App\Tests\Helper;

use Codeception\Exception\ModuleException;
use Codeception\Module;

class MyModule extends Module
{
    /**
     * @throws ModuleException
     */
    public function _beforeSuite(array $settings = []): void
    {
        /** @var Module\Symfony  $symfony */
        $symfony = $this->getModule('Symfony');
        $symfony->runSymfonyConsoleCommand('doctrine:database:drop',['--if-exists'=>true, '--force'=>true]);
        $symfony->runSymfonyConsoleCommand('doctrine:database:create');
        $symfony->runSymfonyConsoleCommand('doctrine:migrations:migrate', ['--no-interaction'=>true]);
        $symfony->runSymfonyConsoleCommand('doctrine:fixtures:load', ['--no-interaction'=>true]);
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      pFad - Phonifier reborn

      Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

      Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


      Alternative Proxies:

      Alternative Proxy

      pFad Proxy

      pFad v3 Proxy

      pFad v4 Proxy