actually this question is not about programming, its about code organization and quality.
I use Scrutinizer to check quality of my code. In my project I get error about dupication of setUp() method in my unit test clasess. Here is both methoods:
First:
/**
* Boot application for testing import command
*/
public function setUp()
{
$kernel = $this->createKernel();
$kernel->boot();
$application = new Application($kernel);
$application->add(new ImportCommand());
$command = $application->find('uber:translations:import');
$this->commandTester = new CommandTester($command);
}
Second:
/**
* Boot application for testing purge memcache command
*/
public function setUp()
{
$kernel = $this->createKernel();
$kernel->boot();
$application = new Application($kernel);
$application->add(new PurgeCommand());
$command = $application->find('uber:translations:purge');
$this->commandTester = new CommandTester($command);
}
Yes, the looks similar, but I use different commands. How I can DRY my code? Can somebody give some advice to me? Thanks!
Aucun commentaire:
Enregistrer un commentaire