Skip to content

Commit c3ae089

Browse files
committed
Make sure that no messages are given when no file is overridden
1 parent 9fbdeb2 commit c3ae089

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

Generator/IntegrationTestGenerator.php

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -35,22 +35,24 @@ public function generate(string $moduleName, OutputInterface $output, bool $over
3535

3636
$classNamePrefix = $this->getClassNamePrefix($moduleName);
3737

38-
$output->writeln('Generating module test');
3938
$testFile = $testPath.'ModuleTest.php';
40-
$testContents = $this->moduleTestGenerator->generate($moduleName, $classNamePrefix);
4139
if (true === $overrideExisting || false === $this->getWriter()->isExist($testFile)) {
40+
$testContents = $this->moduleTestGenerator->generate($moduleName, $classNamePrefix);
41+
$output->writeln('Generating module test');
4242
$this->getWriter()->writeFile($testFile, $testContents);
4343
}
4444

4545
$classNames = $this->classCollector->collect($modulePath);
4646
foreach ($classNames as $className) {
47-
$output->writeln('Generating test for '.$className);
47+
4848
$classStub = $this->classStubFactory->create($moduleName, $className);
4949
$testClassStub = $this->classStubFactory->createTest($classStub);
50-
$testContents = $this->genericTestGenerator->generate($classStub, $testClassStub);
5150
$testFile = $modulePath.'/'.$testClassStub->getRelativePath();
52-
$output->writeln('Writing file '.$testFile, OutputInterface::VERBOSITY_VERBOSE);
51+
5352
if (true === $overrideExisting || false === $this->getWriter()->isExist($testFile)) {
53+
$testContents = $this->genericTestGenerator->generate($classStub, $testClassStub);
54+
$output->writeln('Generating test for '.$className);
55+
$output->writeln('Writing file '.$testFile, OutputInterface::VERBOSITY_VERBOSE);
5456
$this->getWriter()->writeFile($testFile, $testContents);
5557
}
5658
}

0 commit comments

Comments
 (0)