Skip to content

Commit f3336b7

Browse files
committed
[make:controller] [make:crud] [make:registration-form] [make:reset-password] [make:security:form-login] Fix error while generating PHPUnit tests
1 parent c86da84 commit f3336b7

File tree

5 files changed

+10
-5
lines changed

5 files changed

+10
-5
lines changed

src/Maker/MakeController.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111

1212
namespace Symfony\Bundle\MakerBundle\Maker;
1313

14+
use PHPUnit\Framework\TestCase;
1415
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1516
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
1617
use Symfony\Bundle\MakerBundle\ConsoleStyle;
@@ -148,7 +149,7 @@ class: \sprintf('Tests\Controller\%s', $this->controllerClassData->getClassName(
148149
'route_path' => Str::asRoutePath($this->controllerClassData->getClassName(relative: true, withoutSuffix: true)),
149150
]);
150151

151-
if (!class_exists(WebTestCase::class)) {
152+
if (!class_exists(TestCase::class)) {
152153
$io->caution('You\'ll need to install the `symfony/test-pack` to execute the tests for your new controller.');
153154
}
154155
}

src/Maker/MakeCrud.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@
1616
use Doctrine\Inflector\InflectorFactory;
1717
use Doctrine\ORM\EntityManagerInterface;
1818
use Doctrine\ORM\EntityRepository;
19+
use PHPUnit\Framework\TestCase;
1920
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
2021
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
2122
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -280,7 +281,7 @@ class: \sprintf('Tests\Controller\%s', $entityClassDetails->getRelativeNameWitho
280281
]
281282
);
282283

283-
if (!class_exists(WebTestCase::class)) {
284+
if (!class_exists(TestCase::class)) {
284285
$io->caution('You\'ll need to install the `symfony/test-pack` to execute the tests for your new controller.');
285286
}
286287
}

src/Maker/MakeRegistrationForm.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
use Doctrine\ORM\EntityManager;
1616
use Doctrine\ORM\EntityManagerInterface;
1717
use Doctrine\ORM\Mapping\Column;
18+
use PHPUnit\Framework\TestCase;
1819
use Symfony\Bridge\Doctrine\Validator\Constraints\UniqueEntity;
1920
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
2021
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -437,7 +438,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
437438
], $userRepoVars)
438439
);
439440

440-
if (!class_exists(WebTestCase::class)) {
441+
if (!class_exists(TestCase::class)) {
441442
$io->caution('You\'ll need to install the `symfony/test-pack` to execute the tests for your new controller.');
442443
}
443444
}

src/Maker/MakeResetPassword.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\ORM\EntityManagerInterface;
1515
use PhpParser\Builder\Param;
16+
use PHPUnit\Framework\TestCase;
1617
use Symfony\Bridge\Twig\AppVariable;
1718
use Symfony\Bridge\Twig\Mime\TemplatedEmail;
1819
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
@@ -382,7 +383,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
382383
],
383384
);
384385

385-
if (!class_exists(WebTestCase::class)) {
386+
if (!class_exists(TestCase::class)) {
386387
$io->caution('You\'ll need to install the `symfony/test-pack` to execute the tests for your new controller.');
387388
}
388389
}

src/Maker/Security/MakeFormLogin.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313

1414
use Doctrine\Bundle\DoctrineBundle\DoctrineBundle;
1515
use Doctrine\ORM\EntityManager;
16+
use PHPUnit\Framework\TestCase;
1617
use Symfony\Bundle\FrameworkBundle\Controller\AbstractController;
1718
use Symfony\Bundle\FrameworkBundle\KernelBrowser;
1819
use Symfony\Bundle\FrameworkBundle\Test\WebTestCase;
@@ -210,7 +211,7 @@ public function generate(InputInterface $input, ConsoleStyle $io, Generator $gen
210211
],
211212
);
212213

213-
if (!class_exists(WebTestCase::class)) {
214+
if (!class_exists(TestCase::class)) {
214215
$io->caution('You\'ll need to install the `symfony/test-pack` to execute the tests for your new controller.');
215216
}
216217
}

0 commit comments

Comments
 (0)