Skip to content

Commit ff00742

Browse files
committed
feature #779 Create MakerTestCase::createKernel method (franmomu)
This PR was merged into the 1.0-dev branch. Discussion ---------- Create MakerTestCase::createKernel method This will allow to create a custom kernel to register your own bundles and configuration. Commits ------- 9790a67 Expose MakerTestCase::createKernel method
2 parents 44818bc + 9790a67 commit ff00742

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

src/Test/MakerTestCase.php

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,14 @@
1515
use PHPUnit\Framework\TestCase;
1616
use Symfony\Bundle\MakerBundle\MakerInterface;
1717
use Symfony\Bundle\MakerBundle\Str;
18+
use Symfony\Component\HttpKernel\KernelInterface;
1819
use Symfony\Component\Process\Process;
1920

2021
abstract class MakerTestCase extends TestCase
2122
{
23+
/**
24+
* @var KernelInterface
25+
*/
2226
private $kernel;
2327

2428
/**
@@ -100,7 +104,7 @@ protected function assertContainsCount(string $needle, string $haystack, int $co
100104
protected function getMakerInstance(string $makerClass): MakerInterface
101105
{
102106
if (null === $this->kernel) {
103-
$this->kernel = new MakerTestKernel('dev', true);
107+
$this->kernel = $this->createKernel();
104108
$this->kernel->boot();
105109
}
106110

@@ -110,6 +114,11 @@ protected function getMakerInstance(string $makerClass): MakerInterface
110114
return $this->kernel->getContainer()->get($serviceId);
111115
}
112116

117+
protected function createKernel(): KernelInterface
118+
{
119+
return new MakerTestKernel('dev', true);
120+
}
121+
113122
private function hasRequiredDependencyVersions(MakerTestDetails $testDetails, MakerTestEnvironment $testEnv): bool
114123
{
115124
if (empty($testDetails->getRequiredPackageVersions())) {

0 commit comments

Comments
 (0)