From 2cf9460786c1cfeb7468f679de32f450dbb51ccf Mon Sep 17 00:00:00 2001 From: Nicolas Grekas Date: Sun, 20 Oct 2019 22:04:41 +0200 Subject: [PATCH] Allow Symfony 5 + many cleanups --- .gitignore | 1 + .php_cs.dist | 1 + composer.json | 27 +-- phpunit.xml.dist | 2 + src/Command/MakerCommand.php | 4 +- src/Doctrine/DoctrineHelper.php | 4 +- src/EventRegistry.php | 26 ++- src/Maker/MakeAuthenticator.php | 2 +- src/Maker/MakeEntity.php | 6 +- src/Maker/MakeFunctionalTest.php | 2 +- src/Maker/MakeRegistrationForm.php | 26 +-- .../LoginFormAuthenticator.tpl.php | 2 +- .../skeleton/command/Command.tpl.php | 4 +- .../skeleton/serializer/Normalizer.tpl.php | 4 +- .../skeleton/test/Functional.tpl.php | 6 +- src/Test/MakerTestCase.php | 11 +- src/Test/MakerTestEnvironment.php | 9 +- src/Util/ClassSourceManipulator.php | 20 +- src/Util/PrettyPrinter.php | 2 +- tests/Command/MakerCommandTest.php | 24 +- tests/DependencyBuilderTest.php | 11 +- tests/Doctrine/EntityRegeneratorTest.php | 46 ++-- .../expected_overwrite/src/Entity/User.php | 4 +- tests/EventRegistryTest.php | 12 +- tests/FileManagerTest.php | 11 +- tests/GeneratorTest.php | 19 +- tests/GeneratorTwigHelperTest.php | 33 ++- tests/Maker/FunctionalTest.php | 220 +++++++++--------- .../InteractiveSecurityHelperTest.php | 28 ++- tests/Security/SecurityConfigUpdaterTest.php | 25 +- .../SecurityControllerBuilderTest.php | 17 +- tests/Security/UserClassBuilderTest.php | 25 +- tests/StrTest.php | 9 + tests/Util/AutoloaderUtilTest.php | 11 +- tests/Util/ClassSourceManipulatorTest.php | 91 ++++---- tests/Util/ComposerAutoloaderFinderTest.php | 16 +- tests/Util/YamlSourceManipulatorTest.php | 17 +- .../UserProfile_simple_inverse.php | 4 +- ...serProfile_simple_inverse_not_nullable.php | 2 +- tests/ValidatorTest.php | 13 +- .../tests/SecurityControllerTest.php | 14 +- .../tests/SecurityControllerTest.php | 10 +- .../tests/SecurityControllerTest.php | 12 +- .../tests/SecurityControllerTest.php | 12 +- .../tests/SecurityControllerTest.php | 8 +- .../tests/SecurityControllerTest.php | 10 +- .../tests/SecurityControllerTest.php | 6 +- .../tests/GeneratedCommandTest.php | 4 +- .../tests/GeneratedCommandTest.php | 6 +- .../tests/GeneratedControllerWithTwigTest.php | 4 +- .../MakeCrud/src/Entity/SweetFood.php | 1 - .../tests/GeneratedCrudControllerTest.php | 36 +-- .../tests/GeneratedCrudControllerTest.php | 36 +-- .../MakeEntity/tests/GeneratedEntityTest.php | 4 +- .../tests/GeneratedEntityTest.php | 4 +- .../tests/GeneratedEntityTest.php | 6 +- .../tests/GeneratedEntityTest.php | 8 +- .../tests/GeneratedEntityTest.php | 6 +- .../tests/GeneratedEntityTest.php | 5 +- .../tests/GeneratedEntityTest.php | 6 +- .../tests/GeneratedEntityTest.php | 4 +- .../tests/GeneratedEntityTest.php | 5 +- .../tests/GeneratedEntityTest.php | 6 +- .../tests/GeneratedEntityTest.php | 4 +- .../src/Entity/Currency.php | 3 +- .../tests/GeneratedEntityTest.php | 4 +- .../tests/GeneratedEntityTest.php | 5 +- .../tests/GeneratedEntityTest.php | 2 +- .../tests/GeneratedEntityTest.php | 4 +- .../tests/GeneratedEntityTest.php | 4 +- .../tests/GeneratedEntityTest.php | 4 +- .../MakeForm/tests/GeneratedFormTest.php | 2 +- .../src/Entity/Recept.php | 1 - .../tests/GeneratedFormTest.php | 2 +- .../MakeFormForEntity/src/Entity/Property.php | 11 +- .../tests/GeneratedFormTest.php | 2 +- .../MakeFormSTIEntity/src/Entity/SourFood.php | 1 - .../tests/GeneratedFormTest.php | 2 +- .../src/Controller/TestingController.php | 2 +- .../src/Security/StubAuthenticator.php | 2 +- .../tests/RegistrationFormTest.php | 8 +- .../src/Controller/TestingController.php | 2 +- .../src/Security/AutomaticAuthenticator.php | 5 +- .../tests/GeneratedEntityTest.php | 2 +- .../src/Controller/TestingController.php | 2 +- .../src/Security/AutomaticAuthenticator.php | 5 +- .../tests/GeneratedEntityTest.php | 3 - 87 files changed, 629 insertions(+), 463 deletions(-) diff --git a/.gitignore b/.gitignore index 0ab1ad857..a67bde416 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ /vendor/ /tests/tmp/* /.php_cs.cache +/.phpunit.result.cache diff --git a/.php_cs.dist b/.php_cs.dist index 83b96778a..d29d4e5e5 100644 --- a/.php_cs.dist +++ b/.php_cs.dist @@ -19,6 +19,7 @@ return PhpCsFixer\Config::create() ->setRules(array( '@Symfony' => true, '@Symfony:risky' => true, + '@PHPUnit75Migration:risky' => true, 'array_syntax' => ['syntax' => 'short'], 'protected_to_private' => false, 'semicolon_after_instruction' => false, diff --git a/composer.json b/composer.json index eaa3f9a27..f53043236 100644 --- a/composer.json +++ b/composer.json @@ -11,28 +11,29 @@ "homepage": "https://symfony.com/contributors" } ], + "minimum-stability": "dev", "require": { "php": "^7.0.8", "doctrine/inflector": "^1.2", "nikic/php-parser": "^4.0", - "symfony/config": "^3.4|^4.0", - "symfony/console": "^3.4|^4.0", - "symfony/dependency-injection": "^3.4|^4.0", - "symfony/filesystem": "^3.4|^4.0", - "symfony/finder": "^3.4|^4.0", - "symfony/framework-bundle": "^3.4|^4.0", - "symfony/http-kernel": "^3.4|^4.0" + "symfony/config": "^3.4|^4.0|^5.0", + "symfony/console": "^3.4|^4.0|^5.0", + "symfony/dependency-injection": "^3.4|^4.0|^5.0", + "symfony/filesystem": "^3.4|^4.0|^5.0", + "symfony/finder": "^3.4|^4.0|^5.0", + "symfony/framework-bundle": "^3.4|^4.0|^5.0", + "symfony/http-kernel": "^3.4|^4.0|^5.0" }, "require-dev": { - "doctrine/doctrine-bundle": "^1.8", + "doctrine/doctrine-bundle": "^1.8|^2.0", "doctrine/orm": "^2.3", "friendsofphp/php-cs-fixer": "^2.8", "friendsoftwig/twigcs": "^3.1.2", - "symfony/http-client": "^4.3", - "symfony/phpunit-bridge": "^3.4.19|^4.0", - "symfony/process": "^3.4|^4.0", - "symfony/security-core": "^3.4|^4.0", - "symfony/yaml": "^3.4|^4.0" + "symfony/http-client": "^4.3|^5.0", + "symfony/phpunit-bridge": "^4.3|^5.0", + "symfony/process": "^3.4|^4.0|^5.0", + "symfony/security-core": "^3.4|^4.0|^5.0", + "symfony/yaml": "^3.4|^4.0|^5.0" }, "config": { "preferred-install": "dist", diff --git a/phpunit.xml.dist b/phpunit.xml.dist index c51b6b417..f372dbec4 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -6,6 +6,8 @@ backupGlobals="false" colors="true" bootstrap="vendor/autoload.php" + failOnRisky="true" + failOnWarning="true" > diff --git a/src/Command/MakerCommand.php b/src/Command/MakerCommand.php index d6c6c300c..c7c1ed404 100644 --- a/src/Command/MakerCommand.php +++ b/src/Command/MakerCommand.php @@ -99,7 +99,7 @@ protected function interact(InputInterface $input, OutputInterface $output) $this->maker->interact($input, $this->io, $this); } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $this->maker->generate($input, $this->io, $this->generator); @@ -107,6 +107,8 @@ protected function execute(InputInterface $input, OutputInterface $output) if ($this->generator->hasPendingOperations()) { throw new \LogicException('Make sure to call the writeChanges() method on the generator.'); } + + return 0; } public function setApplication(Application $application = null) diff --git a/src/Doctrine/DoctrineHelper.php b/src/Doctrine/DoctrineHelper.php index bcc2d6c68..d9627e1bb 100644 --- a/src/Doctrine/DoctrineHelper.php +++ b/src/Doctrine/DoctrineHelper.php @@ -12,13 +12,13 @@ namespace Symfony\Bundle\MakerBundle\Doctrine; use Doctrine\Common\Persistence\Mapping\AbstractClassMetadataFactory; +use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\Common\Persistence\Mapping\Driver\AnnotationDriver; use Doctrine\Common\Persistence\Mapping\Driver\MappingDriver; use Doctrine\Common\Persistence\Mapping\Driver\MappingDriverChain; +use Doctrine\Common\Persistence\Mapping\MappingException as PersistenceMappingException; use Doctrine\ORM\EntityManagerInterface; -use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\ORM\Mapping\MappingException as ORMMappingException; -use Doctrine\Common\Persistence\Mapping\MappingException as PersistenceMappingException; use Doctrine\ORM\Tools\DisconnectedClassMetadataFactory; use Symfony\Bridge\Doctrine\ManagerRegistry; use Symfony\Bundle\MakerBundle\Util\ClassNameDetails; diff --git a/src/EventRegistry.php b/src/EventRegistry.php index 0f4b87384..d7a7fc02b 100644 --- a/src/EventRegistry.php +++ b/src/EventRegistry.php @@ -14,7 +14,11 @@ use Symfony\Component\Console\Event\ConsoleCommandEvent; use Symfony\Component\Console\Event\ConsoleErrorEvent; use Symfony\Component\Console\Event\ConsoleTerminateEvent; +use Symfony\Component\EventDispatcher\Event as LegacyEvent; use Symfony\Component\EventDispatcher\EventDispatcherInterface; +use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent; +use Symfony\Component\HttpKernel\Event\ControllerEvent; +use Symfony\Component\HttpKernel\Event\ExceptionEvent; use Symfony\Component\HttpKernel\Event\FilterControllerArgumentsEvent; use Symfony\Component\HttpKernel\Event\FilterControllerEvent; use Symfony\Component\HttpKernel\Event\FilterResponseEvent; @@ -23,17 +27,15 @@ use Symfony\Component\HttpKernel\Event\GetResponseForControllerResultEvent; use Symfony\Component\HttpKernel\Event\GetResponseForExceptionEvent; use Symfony\Component\HttpKernel\Event\PostResponseEvent; -use Symfony\Component\HttpKernel\Event\ControllerArgumentsEvent; -use Symfony\Component\HttpKernel\Event\ControllerEvent; -use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\Event\RequestEvent; -use Symfony\Component\HttpKernel\Event\ViewEvent; -use Symfony\Component\HttpKernel\Event\ExceptionEvent; +use Symfony\Component\HttpKernel\Event\ResponseEvent; use Symfony\Component\HttpKernel\Event\TerminateEvent; +use Symfony\Component\HttpKernel\Event\ViewEvent; use Symfony\Component\Security\Core\Event\AuthenticationEvent; use Symfony\Component\Security\Core\Event\AuthenticationFailureEvent; use Symfony\Component\Security\Http\Event\InteractiveLoginEvent; use Symfony\Component\Security\Http\Event\SwitchUserEvent; +use Symfony\Contracts\EventDispatcher\Event; /** * @internal @@ -76,10 +78,10 @@ public function __construct(EventDispatcherInterface $eventDispatcher) $this->eventDispatcher = $eventDispatcher; // Loop through the new event classes - foreach (self::$newEventsMap as $oldEventName => $newEventClass) { + foreach (self::$newEventsMap as $eventName => $newEventClass) { //Check if the new event classes exist, if so replace the old one with the new. - if (isset(self::$eventsMap[$oldEventName]) && class_exists($newEventClass)) { - unset(self::$eventsMap[$oldEventName]); + if (isset(self::$eventsMap[$eventName]) && class_exists($newEventClass)) { + unset(self::$eventsMap[$eventName]); self::$eventsMap[$newEventClass] = $newEventClass; } } @@ -141,7 +143,13 @@ public function getEventClassName(string $event) } if (null !== $type = $args[0]->getType()) { - return (string) $type; + $type = $type instanceof \ReflectionNamedType ? $type->getName() : $type->__toString(); + + if (LegacyEvent::class === $type && class_exists(Event::class)) { + return Event::class; + } + + return $type; } } diff --git a/src/Maker/MakeAuthenticator.php b/src/Maker/MakeAuthenticator.php index b96bac3ff..a66cb716e 100644 --- a/src/Maker/MakeAuthenticator.php +++ b/src/Maker/MakeAuthenticator.php @@ -33,9 +33,9 @@ use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\Console\Input\InputOption; use Symfony\Component\Console\Question\Question; +use Symfony\Component\Form\Form; use Symfony\Component\HttpKernel\Kernel; use Symfony\Component\Yaml\Yaml; -use Symfony\Component\Form\Form; /** * @author Ryan Weaver diff --git a/src/Maker/MakeEntity.php b/src/Maker/MakeEntity.php index d2ccb1fa4..463a1aa00 100644 --- a/src/Maker/MakeEntity.php +++ b/src/Maker/MakeEntity.php @@ -18,17 +18,17 @@ use Symfony\Bundle\MakerBundle\DependencyBuilder; use Symfony\Bundle\MakerBundle\Doctrine\DoctrineHelper; use Symfony\Bundle\MakerBundle\Doctrine\EntityClassGenerator; +use Symfony\Bundle\MakerBundle\Doctrine\EntityRegenerator; +use Symfony\Bundle\MakerBundle\Doctrine\EntityRelation; use Symfony\Bundle\MakerBundle\Doctrine\ORMDependencyBuilder; use Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException; +use Symfony\Bundle\MakerBundle\FileManager; use Symfony\Bundle\MakerBundle\Generator; use Symfony\Bundle\MakerBundle\InputAwareMakerInterface; use Symfony\Bundle\MakerBundle\InputConfiguration; use Symfony\Bundle\MakerBundle\Str; -use Symfony\Bundle\MakerBundle\Doctrine\EntityRegenerator; -use Symfony\Bundle\MakerBundle\FileManager; use Symfony\Bundle\MakerBundle\Util\ClassDetails; use Symfony\Bundle\MakerBundle\Util\ClassSourceManipulator; -use Symfony\Bundle\MakerBundle\Doctrine\EntityRelation; use Symfony\Bundle\MakerBundle\Validator; use Symfony\Component\Console\Command\Command; use Symfony\Component\Console\Input\InputArgument; diff --git a/src/Maker/MakeFunctionalTest.php b/src/Maker/MakeFunctionalTest.php index 31062d880..4ce8657d6 100644 --- a/src/Maker/MakeFunctionalTest.php +++ b/src/Maker/MakeFunctionalTest.php @@ -11,6 +11,7 @@ namespace Symfony\Bundle\MakerBundle\Maker; +use Symfony\Bundle\FrameworkBundle\Test\WebTestAssertionsTrait; use Symfony\Bundle\MakerBundle\ConsoleStyle; use Symfony\Bundle\MakerBundle\DependencyBuilder; use Symfony\Bundle\MakerBundle\Generator; @@ -20,7 +21,6 @@ use Symfony\Component\Console\Input\InputArgument; use Symfony\Component\Console\Input\InputInterface; use Symfony\Component\CssSelector\CssSelectorConverter; -use Symfony\Bundle\FrameworkBundle\Test\WebTestAssertionsTrait; use Symfony\Component\Panther\PantherTestCaseTrait; /** diff --git a/src/Maker/MakeRegistrationForm.php b/src/Maker/MakeRegistrationForm.php index 293ac2e39..2dce4aa33 100644 --- a/src/Maker/MakeRegistrationForm.php +++ b/src/Maker/MakeRegistrationForm.php @@ -293,6 +293,17 @@ private function generateFormClass(ClassNameDetails $userClassDetails, Generator $formFields = [ $usernameField => null, + 'agreeTerms' => [ + 'type' => CheckboxType::class, + 'options_code' => << false, + 'constraints' => [ + new IsTrue([ + 'message' => 'You should agree to our terms.', + ]), + ], +EOF + ], 'plainPassword' => [ 'type' => PasswordType::class, 'options_code' => << 4096, ]), ], -EOF - ], - 'agreeTerms' => [ - 'type' => CheckboxType::class, - 'options_code' => << false, - 'constraints' => [ - new IsTrue([ - 'message' => 'You should agree to our terms.', - ]), - ], EOF ], ]; @@ -330,9 +330,9 @@ private function generateFormClass(ClassNameDetails $userClassDetails, Generator $formFields, $userClassDetails, [ - 'Symfony\Component\Validator\Constraints\NotBlank', - 'Symfony\Component\Validator\Constraints\Length', 'Symfony\Component\Validator\Constraints\IsTrue', + 'Symfony\Component\Validator\Constraints\Length', + 'Symfony\Component\Validator\Constraints\NotBlank', ] ); diff --git a/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php b/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php index 77640bc4a..b95038183 100644 --- a/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php +++ b/src/Resources/skeleton/authenticator/LoginFormAuthenticator.tpl.php @@ -8,8 +8,8 @@ use Symfony\Component\HttpFoundation\Request; use Symfony\Component\Routing\Generator\UrlGeneratorInterface; use Symfony\Component\Security\Core\Authentication\Token\TokenInterface; -use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException; +use Symfony\Component\Security\Core\Exception\CustomUserMessageAuthenticationException; use Symfony\Component\Security\Core\Exception\InvalidCsrfTokenException; use Symfony\Component\Security\Core\Security; use Symfony\Component\Security\Core\User\UserInterface; diff --git a/src/Resources/skeleton/command/Command.tpl.php b/src/Resources/skeleton/command/Command.tpl.php index 0809eba2d..afae18c4b 100644 --- a/src/Resources/skeleton/command/Command.tpl.php +++ b/src/Resources/skeleton/command/Command.tpl.php @@ -22,7 +22,7 @@ protected function configure() ; } - protected function execute(InputInterface $input, OutputInterface $output) + protected function execute(InputInterface $input, OutputInterface $output): int { $io = new SymfonyStyle($input, $output); $arg1 = $input->getArgument('arg1'); @@ -36,5 +36,7 @@ protected function execute(InputInterface $input, OutputInterface $output) } $io->success('You have a new command! Now make it your own! Pass --help to see your options.'); + + return 0; } } diff --git a/src/Resources/skeleton/serializer/Normalizer.tpl.php b/src/Resources/skeleton/serializer/Normalizer.tpl.php index 2ecafa70a..d29478389 100644 --- a/src/Resources/skeleton/serializer/Normalizer.tpl.php +++ b/src/Resources/skeleton/serializer/Normalizer.tpl.php @@ -2,7 +2,7 @@ namespace ; - + use Symfony\Component\Serializer\Normalizer\NormalizerInterface; use Symfony\Component\Serializer\Normalizer\ObjectNormalizer; @@ -28,7 +28,7 @@ public function supportsNormalization($data, $format = null): bool { return $data instanceof \App\Entity\BlogPost; } - + public function hasCacheableSupportsMethod(): bool { diff --git a/src/Resources/skeleton/test/Functional.tpl.php b/src/Resources/skeleton/test/Functional.tpl.php index 002d4d772..7e76354e2 100644 --- a/src/Resources/skeleton/test/Functional.tpl.php +++ b/src/Resources/skeleton/test/Functional.tpl.php @@ -2,7 +2,7 @@ namespace ; - + use Symfony\Component\Panther\PantherTestCase; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; @@ -15,12 +15,12 @@ public function testSomething() $client = static::createClient(); $crawler = $client->request('GET', '/'); - + $this->assertResponseIsSuccessful(); $this->assertSelectorTextContains('h1', 'Hello World'); $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertContains('Hello World', $crawler->filter('h1')->text()); + $this->assertStringContainsString('Hello World', $crawler->filter('h1')->text()); } } diff --git a/src/Test/MakerTestCase.php b/src/Test/MakerTestCase.php index bf6ca858e..4cffb24f3 100644 --- a/src/Test/MakerTestCase.php +++ b/src/Test/MakerTestCase.php @@ -37,29 +37,28 @@ protected function executeMakerCommand(MakerTestDetails $testDetails) $csProcess = $testEnv->runPhpCSFixer($file); $this->assertTrue($csProcess->isSuccessful(), sprintf( - "File '%s' has a php-cs problem: %s\n\n%s", + "File '%s' has a php-cs problem: %s\n", $file, - $csProcess->getErrorOutput(), - file_get_contents($testEnv->getPath().'/'.$file) + $csProcess->getErrorOutput()."\n".$csProcess->getOutput() )); } if ('.twig' === substr($file, -5)) { $csProcess = $testEnv->runTwigCSLint($file); - $this->assertTrue($csProcess->isSuccessful(), sprintf('File "%s" has a twig-cs problem: %s', $file, $csProcess->getOutput())); + $this->assertTrue($csProcess->isSuccessful(), sprintf('File "%s" has a twig-cs problem: %s', $file, $csProcess->getErrorOutput()."\n".$csProcess->getOutput())); } } // run internal tests $internalTestProcess = $testEnv->runInternalTests(); if (null !== $internalTestProcess) { - $this->assertTrue($internalTestProcess->isSuccessful(), sprintf("Error while running the PHPUnit tests *in* the project: \n\n %s \n\n Command Output: %s", $internalTestProcess->getOutput(), $makerTestProcess->getOutput())); + $this->assertTrue($internalTestProcess->isSuccessful(), sprintf("Error while running the PHPUnit tests *in* the project: \n\n %s \n\n Command Output: %s", $internalTestProcess->getErrorOutput()."\n".$internalTestProcess->getOutput(), $makerTestProcess->getErrorOutput()."\n".$makerTestProcess->getOutput())); } // checkout user asserts if (null === $testDetails->getAssert()) { - $this->assertContains('Success', $makerTestProcess->getOutput(), $makerTestProcess->getErrorOutput()); + $this->assertStringContainsString('Success', $makerTestProcess->getOutput(), $makerTestProcess->getErrorOutput()); } else { ($testDetails->getAssert())($makerTestProcess->getOutput(), $testEnv->getPath()); } diff --git a/src/Test/MakerTestEnvironment.php b/src/Test/MakerTestEnvironment.php index aa25b7796..ff2f428e9 100644 --- a/src/Test/MakerTestEnvironment.php +++ b/src/Test/MakerTestEnvironment.php @@ -350,13 +350,20 @@ private function buildFlexSkeleton() // fetch a few packages needed for testing MakerTestProcess::create('composer require phpunit browser-kit symfony/css-selector --prefer-dist --no-progress --no-suggest', $this->flexPath) ->run(); + $this->fs->remove($this->flexPath.'/vendor/symfony/phpunit-bridge'); + + if ('\\' !== \DIRECTORY_SEPARATOR) { + $this->fs->symlink('../../../../../../vendor/symfony/phpunit-bridge', './vendor/symfony/phpunit-bridge'); + } else { + $this->fs->mirror(\dirname(__DIR__, 2).'/vendor/symfony/phpunit-bridge', $this->flexPath.'/vendor/symfony/phpunit-bridge'); + } // temporarily ignoring indirect deprecations - see #237 $replacements = [ [ 'filename' => '.env.test', 'find' => 'SYMFONY_DEPRECATIONS_HELPER=999999', - 'replace' => 'SYMFONY_DEPRECATIONS_HELPER=weak_vendors', + 'replace' => 'SYMFONY_DEPRECATIONS_HELPER=max[self]=0', ], ]; $this->processReplacements($replacements, $this->flexPath); diff --git a/src/Util/ClassSourceManipulator.php b/src/Util/ClassSourceManipulator.php index 323fb83a9..cadfce3a3 100644 --- a/src/Util/ClassSourceManipulator.php +++ b/src/Util/ClassSourceManipulator.php @@ -13,14 +13,14 @@ use Doctrine\Common\Collections\ArrayCollection; use Doctrine\Common\Collections\Collection; +use PhpParser\Builder; use PhpParser\BuilderHelpers; use PhpParser\Comment\Doc; use PhpParser\Lexer; use PhpParser\Node; -use PhpParser\Parser; use PhpParser\NodeTraverser; use PhpParser\NodeVisitor; -use PhpParser\Builder; +use PhpParser\Parser; use Symfony\Bundle\MakerBundle\ConsoleStyle; use Symfony\Bundle\MakerBundle\Doctrine\BaseCollectionRelation; use Symfony\Bundle\MakerBundle\Doctrine\BaseRelation; @@ -1102,13 +1102,13 @@ private function addNodesToSetOtherSideOfOneToOne(RelationOneToOne $relation, Bu self::CONTEXT_CLASS_METHOD )); - // if ($this !== $user->getUserProfile()) { + // if ($user->getUserProfile() !== $this) { $ifNode = new Node\Stmt\If_(new Node\Expr\BinaryOp\NotIdentical( - new Node\Expr\Variable('this'), new Node\Expr\MethodCall( new Node\Expr\Variable($relation->getPropertyName()), $relation->getTargetGetterMethodName() - ) + ), + new Node\Expr\Variable('this') )); // $user->setUserProfile($this); @@ -1137,8 +1137,8 @@ private function addNodesToSetOtherSideOfOneToOne(RelationOneToOne $relation, Bu new Node\Expr\Variable($varName), new Node\Expr\Ternary( new Node\Expr\BinaryOp\Identical( - new Node\Expr\Variable($relation->getPropertyName()), - $this->createNullConstant() + $this->createNullConstant(), + new Node\Expr\Variable($relation->getPropertyName()) ), $this->createNullConstant(), new Node\Expr\Variable('this') @@ -1146,13 +1146,13 @@ private function addNodesToSetOtherSideOfOneToOne(RelationOneToOne $relation, Bu )) ); - // if ($newUserProfile !== $user->getUserProfile()) { + // if ($user->getUserProfile() !== $newUserProfile) { $ifNode = new Node\Stmt\If_(new Node\Expr\BinaryOp\NotIdentical( - new Node\Expr\Variable($varName), new Node\Expr\MethodCall( new Node\Expr\Variable($relation->getPropertyName()), $relation->getTargetGetterMethodName() - ) + ), + new Node\Expr\Variable($varName) )); // $user->setUserProfile($newUserProfile); diff --git a/src/Util/PrettyPrinter.php b/src/Util/PrettyPrinter.php index 292d2c314..62ca68e93 100644 --- a/src/Util/PrettyPrinter.php +++ b/src/Util/PrettyPrinter.php @@ -11,8 +11,8 @@ namespace Symfony\Bundle\MakerBundle\Util; -use PhpParser\PrettyPrinter\Standard; use PhpParser\Node\Stmt; +use PhpParser\PrettyPrinter\Standard; /** * @internal diff --git a/tests/Command/MakerCommandTest.php b/tests/Command/MakerCommandTest.php index ca1ccaf90..e1a1b3934 100644 --- a/tests/Command/MakerCommandTest.php +++ b/tests/Command/MakerCommandTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Command; use PHPUnit\Framework\TestCase; @@ -12,16 +21,15 @@ class MakerCommandTest extends TestCase { - /** - * @expectedException \Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException - * @expectedExceptionMessageRegExp /composer require foo-package/ - */ public function testExceptionOnMissingDependencies() { + $this->expectException(\Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException::class); + $this->expectExceptionMessageRegExp('/composer require foo-package/'); + $maker = $this->createMock(MakerInterface::class); $maker->expects($this->once()) ->method('configureDependencies') - ->willReturnCallback(function(DependencyBuilder $depBuilder) { + ->willReturnCallback(function (DependencyBuilder $depBuilder) { $depBuilder->addClassDependency('Foo', 'foo-package'); }); @@ -31,7 +39,7 @@ public function testExceptionOnMissingDependencies() // needed because it's normally set by the Application $command->setName('make:foo'); $tester = new CommandTester($command); - $tester->execute(array()); + $tester->execute([]); } public function testExceptionOnUnknownRootNamespace() @@ -44,8 +52,8 @@ public function testExceptionOnUnknownRootNamespace() // needed because it's normally set by the Application $command->setName('make:foo'); $tester = new CommandTester($command); - $tester->execute(array()); + $tester->execute([]); - $this->assertContains('using a namespace other than "Unknown"', $tester->getDisplay()); + $this->assertStringContainsString('using a namespace other than "Unknown"', $tester->getDisplay()); } } diff --git a/tests/DependencyBuilderTest.php b/tests/DependencyBuilderTest.php index 5112233a7..39568b576 100644 --- a/tests/DependencyBuilderTest.php +++ b/tests/DependencyBuilderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests; use PHPUnit\Framework\TestCase; @@ -82,7 +91,7 @@ public function getMissingPackagesMessageTests() yield 'nothing_missing' => [ [], [], - '' + '', ]; yield 'missing_one_package' => [ diff --git a/tests/Doctrine/EntityRegeneratorTest.php b/tests/Doctrine/EntityRegeneratorTest.php index 2317ff4a9..bd126aaae 100644 --- a/tests/Doctrine/EntityRegeneratorTest.php +++ b/tests/Doctrine/EntityRegeneratorTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Doctrine; use Doctrine\Bundle\DoctrineBundle\DoctrineBundle; @@ -44,12 +53,12 @@ public function getRegenerateEntitiesTests() { yield 'regenerate_no_overwrite' => [ 'expected_no_overwrite', - false + false, ]; yield 'regenerate_overwrite' => [ 'expected_overwrite', - true + true, ]; } @@ -81,7 +90,7 @@ private function doTestRegeneration(string $sourceDir, Kernel $kernel, string $n $autoloaderUtil = $this->createMock(AutoloaderUtil::class); $autoloaderUtil->expects($this->any()) ->method('getPathForFutureClass') - ->willReturnCallback(function($className) use ($tmpDir, $targetDirName) { + ->willReturnCallback(function ($className) use ($tmpDir, $targetDirName) { $shortClassName = str_replace('Symfony\Bundle\MakerBundle\Tests\tmp\\'.$targetDirName.'\src\\', '', $className); // strip the App\, change \ to / and add .php @@ -103,7 +112,6 @@ private function doTestRegeneration(string $sourceDir, Kernel $kernel, string $n $finder = (new Finder())->in($expectedDir)->files(); foreach ($finder as $file) { - /** @var SplFileInfo $file */ $expectedContents = file_get_contents($file->getPathname()); @@ -120,6 +128,7 @@ private function createAllButTraitsIterator(string $sourceDir): \Iterator { $directoryIterator = new \RecursiveDirectoryIterator($sourceDir, \FilesystemIterator::SKIP_DOTS); $filter = new AllButTraitsIterator($directoryIterator); + return new \RecursiveIteratorIterator($filter, \RecursiveIteratorIterator::SELF_FIRST); } } @@ -130,10 +139,10 @@ class TestEntityRegeneratorKernel extends Kernel public function registerBundles() { - return array( + return [ new FrameworkBundle(), new DoctrineBundle(), - ); + ]; } protected function configureRoutes(RouteCollectionBuilder $routes) @@ -153,12 +162,12 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load 'EntityRegenerator' => [ 'is_bundle' => false, 'type' => 'annotation', - 'dir' => '%kernel.root_dir%/src/Entity', + 'dir' => '%kernel.project_dir%/src/Entity', 'prefix' => 'Symfony\Bundle\MakerBundle\Tests\tmp\current_project\src\Entity', 'alias' => 'EntityRegeneratorApp', - ] - ] - ] + ], + ], + ], ]); } @@ -179,10 +188,10 @@ class TestXmlEntityRegeneratorKernel extends Kernel public function registerBundles() { - return array( + return [ new FrameworkBundle(), new DoctrineBundle(), - ); + ]; } protected function configureRoutes(RouteCollectionBuilder $routes) @@ -203,12 +212,12 @@ protected function configureContainer(ContainerBuilder $c, LoaderInterface $load 'EntityRegenerator' => [ 'is_bundle' => false, 'type' => 'xml', - 'dir' => '%kernel.root_dir%/config/doctrine', + 'dir' => '%kernel.project_dir%/config/doctrine', 'prefix' => 'Symfony\Bundle\MakerBundle\Tests\tmp\current_project_xml\src\Entity', 'alias' => 'EntityRegeneratorApp', - ] - ] - ] + ], + ], + ], ]); } @@ -225,7 +234,8 @@ public function getRootDir() class AllButTraitsIterator extends \RecursiveFilterIterator { - public function accept() { - return !in_array($this->current()->getFilename(), []); + public function accept() + { + return !\in_array($this->current()->getFilename(), []); } } diff --git a/tests/Doctrine/fixtures/expected_overwrite/src/Entity/User.php b/tests/Doctrine/fixtures/expected_overwrite/src/Entity/User.php index 13a5f4ecc..f0a9ebe8b 100644 --- a/tests/Doctrine/fixtures/expected_overwrite/src/Entity/User.php +++ b/tests/Doctrine/fixtures/expected_overwrite/src/Entity/User.php @@ -54,8 +54,8 @@ public function setUserProfile(?UserProfile $userProfile): self $this->userProfile = $userProfile; // set (or unset) the owning side of the relation if necessary - $newUser = $userProfile === null ? null : $this; - if ($newUser !== $userProfile->getUser()) { + $newUser = null === $userProfile ? null : $this; + if ($userProfile->getUser() !== $newUser) { $userProfile->setUser($newUser); } diff --git a/tests/EventRegistryTest.php b/tests/EventRegistryTest.php index 2a7943a35..611677a34 100644 --- a/tests/EventRegistryTest.php +++ b/tests/EventRegistryTest.php @@ -1,11 +1,19 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests; use PHPUnit\Framework\TestCase; use Symfony\Bundle\MakerBundle\EventRegistry; use Symfony\Component\Console\Event\ConsoleCommandEvent; -use Symfony\Component\EventDispatcher\Event; use Symfony\Component\EventDispatcher\EventDispatcherInterface; use Symfony\Component\HttpKernel\Event\ExceptionEvent; @@ -67,7 +75,7 @@ public function testGetNewEventClassNameFromStandardList() } } -class DummyEvent extends Event +class DummyEvent { public function methodNoArg() { diff --git a/tests/FileManagerTest.php b/tests/FileManagerTest.php index d0ce0259d..da4ec3d98 100644 --- a/tests/FileManagerTest.php +++ b/tests/FileManagerTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests; use PHPUnit\Framework\TestCase; @@ -87,7 +96,7 @@ public function getAbsolutePathTests() 'D:\foo\bar', ]; - yield 'windows_already_absolute_path' => [ + yield 'windows_already_absolute_path_bis' => [ 'D:\path\to\project', 'D:/foo/bar', 'D:/foo/bar', diff --git a/tests/GeneratorTest.php b/tests/GeneratorTest.php index d0ebc5c2a..9027aab8d 100644 --- a/tests/GeneratorTest.php +++ b/tests/GeneratorTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests; use PHPUnit\Framework\TestCase; @@ -31,7 +40,7 @@ public function getClassNameDetailsTests() 'Controller\\', '', 'App\\Controller\\Foo', - 'Foo' + 'Foo', ]; yield 'with_suffix' => [ @@ -39,7 +48,7 @@ public function getClassNameDetailsTests() 'Controller', 'Controller', 'App\\Controller\\FooController', - 'FooController' + 'FooController', ]; yield 'custom_class' => [ @@ -47,7 +56,7 @@ public function getClassNameDetailsTests() 'Controller', '', 'Foo\Bar\Baz', - 'Bar\Baz' + 'Bar\Baz', ]; yield 'custom_class_with_suffix' => [ @@ -55,7 +64,7 @@ public function getClassNameDetailsTests() 'Controller', 'Controller', 'Foo\Bar\Baz', - 'Bar\Baz' + 'Bar\Baz', ]; yield 'enty_fqcn' => [ @@ -63,7 +72,7 @@ public function getClassNameDetailsTests() 'Entity\\', '', 'App\\Entity\\User', - 'User' + 'User', ]; } } diff --git a/tests/GeneratorTwigHelperTest.php b/tests/GeneratorTwigHelperTest.php index dd4bf28fe..d33b9ea0e 100644 --- a/tests/GeneratorTwigHelperTest.php +++ b/tests/GeneratorTwigHelperTest.php @@ -1,16 +1,25 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests; +use PHPUnit\Framework\TestCase; use Symfony\Bundle\MakerBundle\FileManager; use Symfony\Bundle\MakerBundle\GeneratorTwigHelper; -use PHPUnit\Framework\TestCase; class GeneratorTwigHelperTest extends TestCase { - /** * @dataProvider getEntityFieldPrintCodeTests + * * @param string $entity * @param string $fieldName * @param string $fieldType @@ -34,70 +43,70 @@ public function getEntityFieldPrintCodeTests() 'entity', 'normal', 'string', - 'entity.normal' + 'entity.normal', ]; yield 'normal_upper' => [ 'entity', 'normalUpper', 'string', - 'entity.normalUpper' + 'entity.normalUpper', ]; yield 'underscore' => [ 'entity', 'with_underscore', 'string', - 'entity.withUnderscore' + 'entity.withUnderscore', ]; yield 'underscore_number' => [ 'entity', 'field_100', 'string', - 'entity.field100' + 'entity.field100', ]; yield 'underscore_first' => [ 'entity', '_field', 'string', - 'entity.field' + 'entity.field', ]; yield 'normal_datetime' => [ 'entity', 'normal', 'datetime', - 'entity.normal ? entity.normal|date(\'Y-m-d H:i:s\') : \'\'' + 'entity.normal ? entity.normal|date(\'Y-m-d H:i:s\') : \'\'', ]; yield 'normal_date' => [ 'entity', 'normal', 'date', - 'entity.normal ? entity.normal|date(\'Y-m-d\') : \'\'' + 'entity.normal ? entity.normal|date(\'Y-m-d\') : \'\'', ]; yield 'normal_time' => [ 'entity', 'normal', 'time', - 'entity.normal ? entity.normal|date(\'H:i:s\') : \'\'' + 'entity.normal ? entity.normal|date(\'H:i:s\') : \'\'', ]; yield 'normal_array' => [ 'entity', 'normal', 'array', - 'entity.normal ? entity.normal|join(\', \') : \'\'' + 'entity.normal ? entity.normal|join(\', \') : \'\'', ]; yield 'normal_boolean' => [ 'entity', 'normal', 'boolean', - 'entity.normal ? \'Yes\' : \'No\'' + 'entity.normal ? \'Yes\' : \'No\'', ]; } } diff --git a/tests/Maker/FunctionalTest.php b/tests/Maker/FunctionalTest.php index 3a8631f9f..87165c0b2 100644 --- a/tests/Maker/FunctionalTest.php +++ b/tests/Maker/FunctionalTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Maker; use Symfony\Bundle\FrameworkBundle\Console\Application; @@ -75,7 +84,7 @@ public function getCommandTests() // command name 'app:foo', ]) - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeCommand') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeCommand'), ]; yield 'command_in_custom_root_namespace' => [MakerTestDetails::createTest( @@ -85,7 +94,7 @@ public function getCommandTests() 'app:foo', ]) ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeCommandInCustomRootNamespace') - ->changeRootNamespace('Custom') + ->changeRootNamespace('Custom'), ]; yield 'controller_basic' => [MakerTestDetails::createTest( @@ -98,7 +107,7 @@ public function getCommandTests() ->assert(function (string $output, string $directory) { // make sure the template was not configured $this->assertContainsCount('created: ', $output, 1); - }) + }), ]; yield 'controller_with_template_and_base' => [MakerTestDetails::createTest( @@ -108,7 +117,7 @@ public function getCommandTests() 'FooTwig', ]) ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeControllerTwig') - ->addExtraDependencies('twig') + ->addExtraDependencies('twig'), ]; yield 'controller_with_template_no_base' => [MakerTestDetails::createTest( @@ -119,7 +128,7 @@ public function getCommandTests() ]) ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeControllerTwig') ->addExtraDependencies('twig') - ->deleteFile('templates/base.html.twig') + ->deleteFile('templates/base.html.twig'), ]; yield 'controller_without_template' => [MakerTestDetails::createTest( @@ -133,9 +142,9 @@ public function getCommandTests() ->assert(function (string $output, string $directory) { // make sure the template was not configured $this->assertContainsCount('created: ', $output, 1); - $this->assertContains('created: src/Controller/FooNoTemplateController.php', $output); - $this->assertNotContains('created: templates/foo_no_template/index.html.twig', $output); - }) + $this->assertStringContainsString('created: src/Controller/FooNoTemplateController.php', $output); + $this->assertStringNotContainsString('created: templates/foo_no_template/index.html.twig', $output); + }), ]; yield 'controller_sub_namespace' => [MakerTestDetails::createTest( @@ -147,8 +156,8 @@ public function getCommandTests() ->assert(function (string $output, string $directory) { $this->assertFileExists($directory.'/src/Controller/Admin/FooBarController.php'); - $this->assertContains('created: src/Controller/Admin/FooBarController.php', $output); - }) + $this->assertStringContainsString('created: src/Controller/Admin/FooBarController.php', $output); + }), ]; yield 'controller_sub_namespace_template' => [MakerTestDetails::createTest( @@ -160,7 +169,7 @@ public function getCommandTests() ->addExtraDependencies('twig') ->assert(function (string $output, string $directory) { $this->assertFileExists($directory.'/templates/admin/foo_bar/index.html.twig'); - }) + }), ]; yield 'controller_full_custom_namespace' => [MakerTestDetails::createTest( @@ -171,9 +180,9 @@ public function getCommandTests() ]) ->addExtraDependencies('twig') ->assert(function (string $output, string $directory) { - $this->assertContains('created: src/Foo/Bar/CoolController.php', $output); - $this->assertContains('created: templates/foo/bar/cool/index.html.twig', $output); - }) + $this->assertStringContainsString('created: src/Foo/Bar/CoolController.php', $output); + $this->assertStringContainsString('created: templates/foo/bar/cool/index.html.twig', $output); + }), ]; yield 'fixtures' => [MakerTestDetails::createTest( @@ -182,8 +191,8 @@ public function getCommandTests() 'FooFixtures', ]) ->assert(function (string $output, string $directory) { - $this->assertContains('created: src/DataFixtures/FooFixtures.php', $output); - }) + $this->assertStringContainsString('created: src/DataFixtures/FooFixtures.php', $output); + }), ]; yield 'form_basic' => [MakerTestDetails::createTest( @@ -193,7 +202,7 @@ public function getCommandTests() 'FooBar', '', ]) - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeForm') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeForm'), ]; yield 'form_with_entity' => [MakerTestDetails::createTest( @@ -204,7 +213,7 @@ public function getCommandTests() 'SourFood', ]) ->addExtraDependencies('orm') - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFormForEntity') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFormForEntity'), ]; yield 'form_for_non_entity_dto' => [MakerTestDetails::createTest( @@ -214,7 +223,7 @@ public function getCommandTests() 'TaskType', '\\App\\Form\\Data\\TaskData', ]) - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFormForNonEntityDto') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFormForNonEntityDto'), ]; yield 'form_for_sti_entity' => [MakerTestDetails::createTest( @@ -225,7 +234,7 @@ public function getCommandTests() 'SourFood', ]) ->addExtraDependencies('orm') - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFormSTIEntity') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFormSTIEntity'), ]; yield 'form_for_embebadle_entity' => [MakerTestDetails::createTest( @@ -236,7 +245,7 @@ public function getCommandTests() 'Food', ]) ->addExtraDependencies('orm') - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFormEmbedableEntity') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFormEmbedableEntity'), ]; yield 'functional_maker' => [MakerTestDetails::createTest( @@ -245,7 +254,7 @@ public function getCommandTests() // functional test class name 'FooBar', ]) - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFunctional') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFunctional'), ]; yield 'functional_with_panther' => [MakerTestDetails::createTest( @@ -256,7 +265,7 @@ public function getCommandTests() ]) ->addExtraDependencies('panther') ->setRequiredPhpVersion(70100) - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFunctional') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeFunctional'), ]; yield 'subscriber' => [MakerTestDetails::createTest( @@ -266,7 +275,7 @@ public function getCommandTests() 'FooBar', // event name 'kernel.request', - ]) + ]), ]; yield 'subscriber_unknown_event_class' => [MakerTestDetails::createTest( @@ -276,7 +285,7 @@ public function getCommandTests() 'FooBar', // event name 'foo.unknown_event', - ]) + ]), ]; yield 'serializer_encoder' => [MakerTestDetails::createTest( @@ -286,7 +295,7 @@ public function getCommandTests() 'FooBarEncoder', // encoder format 'foobar', - ]) + ]), ]; yield 'twig_extension' => [MakerTestDetails::createTest( @@ -294,7 +303,7 @@ public function getCommandTests() [ // extension class name 'FooBar', - ]) + ]), ]; yield 'unit_test' => [MakerTestDetails::createTest( @@ -302,7 +311,7 @@ public function getCommandTests() [ // class name 'FooBar', - ]) + ]), ]; yield 'validator' => [MakerTestDetails::createTest( @@ -310,7 +319,7 @@ public function getCommandTests() [ // validator name 'FooBar', - ]) + ]), ]; yield 'voter' => [MakerTestDetails::createTest( @@ -318,7 +327,7 @@ public function getCommandTests() [ // voter class name 'FooBar', - ]) + ]), ]; yield 'auth_empty_one_firewall' => [ @@ -334,12 +343,12 @@ public function getCommandTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeAuthenticator') ->assert( function (string $output, string $directory) { - $this->assertContains('Success', $output); + $this->assertStringContainsString('Success', $output); $fs = new Filesystem(); $this->assertTrue($fs->exists(sprintf('%s/src/Security/AppCustomAuthenticator.php', $directory))); - $securityConfig = Yaml::parse(file_get_contents(sprintf("%s/config/packages/security.yaml", $directory))); + $securityConfig = Yaml::parse(file_get_contents(sprintf('%s/config/packages/security.yaml', $directory))); $this->assertEquals( 'App\\Security\\AppCustomAuthenticator', $securityConfig['security']['firewalls']['main']['guard']['authenticators'][0] @@ -363,9 +372,9 @@ function (string $output, string $directory) { ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeAuthenticatorMultipleFirewalls') ->assert( function (string $output, string $directory) { - $this->assertContains('Success', $output); + $this->assertStringContainsString('Success', $output); - $securityConfig = Yaml::parse(file_get_contents(sprintf("%s/config/packages/security.yaml", $directory))); + $securityConfig = Yaml::parse(file_get_contents(sprintf('%s/config/packages/security.yaml', $directory))); $this->assertEquals( 'App\\Security\\AppCustomAuthenticator', $securityConfig['security']['firewalls']['second']['guard']['authenticators'][0] @@ -389,9 +398,9 @@ function (string $output, string $directory) { ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeAuthenticatorExistingAuthenticator') ->assert( function (string $output, string $directory) { - $this->assertContains('Success', $output); + $this->assertStringContainsString('Success', $output); - $securityConfig = Yaml::parse(file_get_contents(sprintf("%s/config/packages/security.yaml", $directory))); + $securityConfig = Yaml::parse(file_get_contents(sprintf('%s/config/packages/security.yaml', $directory))); $this->assertEquals( 'App\\Security\\AppCustomAuthenticator', $securityConfig['security']['firewalls']['main']['guard']['entry_point'] @@ -417,9 +426,9 @@ function (string $output, string $directory) { ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeAuthenticatorMultipleFirewallsExistingAuthenticator') ->assert( function (string $output, string $directory) { - $this->assertContains('Success', $output); + $this->assertStringContainsString('Success', $output); - $securityConfig = Yaml::parse(file_get_contents(sprintf("%s/config/packages/security.yaml", $directory))); + $securityConfig = Yaml::parse(file_get_contents(sprintf('%s/config/packages/security.yaml', $directory))); $this->assertEquals( 'App\\Security\\AppCustomAuthenticator', $securityConfig['security']['firewalls']['second']['guard']['entry_point'] @@ -440,7 +449,7 @@ function (string $output, string $directory) { 'SecurityController', // field name 'userEmail', - "no" + 'no', ] ) ->addExtraDependencies('doctrine') @@ -451,7 +460,7 @@ function (string $output, string $directory) { ->updateSchemaAfterCommand() ->assert( function (string $output, string $directory) { - $this->assertContains('Success', $output); + $this->assertStringContainsString('Success', $output); $fs = new Filesystem(); $this->assertTrue($fs->exists(sprintf('%s/src/Controller/SecurityController.php', $directory))); @@ -475,13 +484,13 @@ function (string $output, string $directory) { 'App\\Security\\User', // username field => userEmail 0, - "no" + 'no', ] ) ->addExtraDependencies('doctrine/annotations') ->addExtraDependencies('twig') ->addExtraDependencies('symfony/form') - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeAuthenticatorLoginFormCustomUsernameField') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeAuthenticatorLoginFormCustomUsernameField'), ]; yield 'auth_login_form_user_entity_no_encoder' => [ @@ -494,7 +503,7 @@ function (string $output, string $directory) { 'AppCustomAuthenticator', // controller name 'SecurityController', - "no" + 'no', ] ) ->addExtraDependencies('doctrine') @@ -517,7 +526,7 @@ function (string $output, string $directory) { 'SecurityController', // user class 'App\Security\User', - "no" + 'no', ] ) ->addExtraDependencies('twig') @@ -538,7 +547,7 @@ function (string $output, string $directory) { 'SecurityController', // user class 'App\Security\User', - "no" + 'no', ] ) ->addExtraDependencies('twig') @@ -557,7 +566,7 @@ function (string $output, string $directory) { 'AppCustomAuthenticator', // controller name 'SecurityController', - "no" + 'no', ] ) ->addExtraDependencies('doctrine') @@ -584,7 +593,7 @@ function (string $output, string $directory) { ->addExtraDependencies('doctrine') ->setGuardAuthenticator('main', 'App\\Security\\AutomaticAuthenticator') ->setRequiredPhpVersion(70100) - ->updateSchemaAfterCommand() + ->updateSchemaAfterCommand(), ]; yield 'user_security_model_no_password' => [MakerTestDetails::createTest( @@ -603,7 +612,7 @@ function (string $output, string $directory) { 'src/Security/UserProvider.php', 'throw new \Exception(\'TODO: fill in refreshUser() inside \'.__FILE__);', 'return $user;' - ) + ), ]; yield 'migration_with_changes' => [MakerTestDetails::createTest( @@ -616,7 +625,7 @@ function (string $output, string $directory) { // so let's install it ->addExtraDependencies('doctrine/orm') ->assert(function (string $output, string $directory) { - $this->assertContains('Success', $output); + $this->assertStringContainsString('Success', $output); $finder = new Finder(); $finder->in($directory.'/src/Migrations') @@ -626,8 +635,8 @@ function (string $output, string $directory) { // see that the exact filename is in the output $iterator = $finder->getIterator(); $iterator->rewind(); - $this->assertContains(sprintf('"src/Migrations/%s"', $iterator->current()->getFilename()), $output); - }) + $this->assertStringContainsString(sprintf('"src/Migrations/%s"', $iterator->current()->getFilename()), $output); + }), ]; yield 'migration_no_changes' => [MakerTestDetails::createTest( @@ -640,8 +649,8 @@ function (string $output, string $directory) { ->assert(function (string $output, string $directory) { $this->assertNotContains('Success', $output); - $this->assertContains('No database changes were detected', $output); - }) + $this->assertStringContainsString('No database changes were detected', $output); + }), ]; yield 'crud_basic' => [MakerTestDetails::createTest( @@ -654,9 +663,9 @@ function (string $output, string $directory) { // need for crud web tests ->configureDatabase() ->assert(function (string $output, string $directory) { - $this->assertContains('created: src/Controller/SweetFoodController.php', $output); - $this->assertContains('created: src/Form/SweetFoodType.php', $output); - }) + $this->assertStringContainsString('created: src/Controller/SweetFoodController.php', $output); + $this->assertStringContainsString('created: src/Form/SweetFoodType.php', $output); + }), ]; yield 'crud_basic_in_custom_root_namespace' => [MakerTestDetails::createTest( @@ -670,9 +679,9 @@ function (string $output, string $directory) { // need for crud web tests ->configureDatabase() ->assert(function (string $output, string $directory) { - $this->assertContains('created: src/Controller/SweetFoodController.php', $output); - $this->assertContains('created: src/Form/SweetFoodType.php', $output); - }) + $this->assertStringContainsString('created: src/Controller/SweetFoodController.php', $output); + $this->assertStringContainsString('created: src/Form/SweetFoodType.php', $output); + }), ]; yield 'crud_repository' => [MakerTestDetails::createTest( @@ -685,9 +694,9 @@ function (string $output, string $directory) { // need for crud web tests ->configureDatabase() ->assert(function (string $output, string $directory) { - $this->assertContains('created: src/Controller/SweetFoodController.php', $output); - $this->assertContains('created: src/Form/SweetFoodType.php', $output); - }) + $this->assertStringContainsString('created: src/Controller/SweetFoodController.php', $output); + $this->assertStringContainsString('created: src/Form/SweetFoodType.php', $output); + }), ]; yield 'crud_with_no_base' => [MakerTestDetails::createTest( @@ -702,9 +711,9 @@ function (string $output, string $directory) { ->configureDatabase() ->deleteFile('templates/base.html.twig') ->assert(function (string $output, string $directory) { - $this->assertContains('created: src/Controller/SweetFoodController.php', $output); - $this->assertContains('created: src/Form/SweetFoodType.php', $output); - }) + $this->assertStringContainsString('created: src/Controller/SweetFoodController.php', $output); + $this->assertStringContainsString('created: src/Form/SweetFoodType.php', $output); + }), ]; yield 'registration_form_entity_guard_authenticate' => [MakerTestDetails::createTest( @@ -720,7 +729,7 @@ function (string $output, string $directory) { ]) ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeRegistrationFormEntity') ->configureDatabase() - ->updateSchemaAfterCommand() + ->updateSchemaAfterCommand(), ]; // sanity check on all the interactive questions @@ -733,9 +742,9 @@ function (string $output, string $directory) { 'n', // no UniqueEntity '', // yes authenticate after 'main', // firewall - '1' // authenticator + '1', // authenticator ]) - ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeRegistrationFormNoGuessing') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeRegistrationFormNoGuessing'), ]; yield 'registration_form_entity_no_authenticate' => [MakerTestDetails::createTest( @@ -748,7 +757,7 @@ function (string $output, string $directory) { ]) ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeRegistrationFormEntity') ->configureDatabase() - ->updateSchemaAfterCommand() + ->updateSchemaAfterCommand(), ]; yield 'auth_login_form_user_entity_with_encoder_logout' => [ @@ -762,25 +771,25 @@ function (string $output, string $directory) { // controller name 'SecurityController', // logout support - "yes" + 'yes', ] ) ->addExtraDependencies('doctrine') ->addExtraDependencies('twig') ->addExtraDependencies('symfony/form') - ->setFixtureFilesPath(__DIR__ . '/../fixtures/MakeAuthenticatorLoginFormUserEntityLogout') + ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeAuthenticatorLoginFormUserEntityLogout') ->configureDatabase() ->updateSchemaAfterCommand() ->assert( function (string $output, string $directory) { - $this->assertContains('Success', $output); + $this->assertStringContainsString('Success', $output); $fs = new Filesystem(); $this->assertTrue($fs->exists(sprintf('%s/src/Controller/SecurityController.php', $directory))); $this->assertTrue($fs->exists(sprintf('%s/templates/security/login.html.twig', $directory))); $this->assertTrue($fs->exists(sprintf('%s/src/Security/AppCustomAuthenticator.php', $directory))); - $securityConfig = Yaml::parse(file_get_contents(sprintf("%s/config/packages/security.yaml", $directory))); + $securityConfig = Yaml::parse(file_get_contents(sprintf('%s/config/packages/security.yaml', $directory))); $this->assertEquals( 'app_logout', $securityConfig['security']['firewalls']['main']['logout']['path'] @@ -788,7 +797,6 @@ function (string $output, string $directory) { } ), ]; - } public function getCommandEntityTests() @@ -804,7 +812,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntity') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_new_api_resource' => [MakerTestDetails::createTest( @@ -822,13 +830,13 @@ public function getCommandEntityTests() ->configureDatabase() ->updateSchemaAfterCommand() ->setRequiredPhpVersion(70100) - ->assert(function(string $output, string $directory) { + ->assert(function (string $output, string $directory) { $this->assertFileExists($directory.'/src/Entity/User.php'); $content = file_get_contents($directory.'/src/Entity/User.php'); - $this->assertContains('use ApiPlatform\Core\Annotation\ApiResource;', $content); - $this->assertContains('@ApiResource', $content); - }) + $this->assertStringContainsString('use ApiPlatform\Core\Annotation\ApiResource;', $content); + $this->assertStringContainsString('@ApiResource', $content); + }), ]; yield 'entity_with_fields' => [MakerTestDetails::createTest( @@ -853,7 +861,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntity') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_updating' => [MakerTestDetails::createTest( @@ -875,7 +883,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityUpdate') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_many_to_one_simple_with_inverse' => [MakerTestDetails::createTest( @@ -905,7 +913,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityManyToOne') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_many_to_one_simple_no_inverse' => [MakerTestDetails::createTest( @@ -931,7 +939,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityManyToOneNoInverse') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_many_to_one_self_referencing' => [MakerTestDetails::createTest( @@ -961,7 +969,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntitySelfReferencing') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_exists_in_root' => [MakerTestDetails::createTest( @@ -991,7 +999,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityExistsInRoot') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_one_to_many_simple' => [MakerTestDetails::createTest( @@ -1019,7 +1027,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityOneToMany') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_many_to_many_simple' => [MakerTestDetails::createTest( @@ -1045,7 +1053,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityManyToMany') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_many_to_many_simple_in_custom_root_namespace' => [MakerTestDetails::createTest( @@ -1072,7 +1080,7 @@ public function getCommandEntityTests() ->changeRootNamespace('Custom') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_one_to_one_simple' => [MakerTestDetails::createTest( @@ -1100,7 +1108,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityOneToOne') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_many_to_one_vendor_target' => [MakerTestDetails::createTest( @@ -1131,17 +1139,17 @@ public function getCommandEntityTests() '"App\\\Tests\\\": "tests/",'."\n".' "Some\\\Vendor\\\": "vendor/some-vendor/src",' ) ->assert(function (string $output, string $directory) { - $this->assertContains('updated: src/Entity/User.php', $output); + $this->assertStringContainsString('updated: src/Entity/User.php', $output); $this->assertNotContains('updated: vendor/', $output); // sanity checks on the generated code $finder = new Finder(); $finder->in($directory.'/src/Entity')->files()->name('*.php'); - $this->assertEquals(1, count($finder)); + $this->assertCount(1, $finder); $this->assertNotContains('inversedBy', file_get_contents($directory.'/src/Entity/User.php')); }) - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_many_to_many_vendor_target' => [MakerTestDetails::createTest( @@ -1174,7 +1182,7 @@ public function getCommandEntityTests() $this->assertNotContains('inversedBy', file_get_contents($directory.'/src/Entity/User.php')); }) - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_one_to_one_vendor_target' => [MakerTestDetails::createTest( @@ -1209,7 +1217,7 @@ public function getCommandEntityTests() $this->assertNotContains('inversedBy', file_get_contents($directory.'/src/Entity/User.php')); }) - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_regenerate' => [MakerTestDetails::createTest( @@ -1221,7 +1229,7 @@ public function getCommandEntityTests() ->setArgumentsString('--regenerate') ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityRegenerate') ->configureDatabase(true) - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_regenerate_embeddable_object' => [MakerTestDetails::createTest( @@ -1233,7 +1241,7 @@ public function getCommandEntityTests() ->setArgumentsString('--regenerate') ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityRegenerateEmbeddableObject') ->configureDatabase() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_regenerate_embeddable' => [MakerTestDetails::createTest( @@ -1245,7 +1253,7 @@ public function getCommandEntityTests() ->setArgumentsString('--regenerate --overwrite') ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityRegenerateEmbedable') ->configureDatabase() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_regenerate_overwrite' => [MakerTestDetails::createTest( @@ -1257,7 +1265,7 @@ public function getCommandEntityTests() ->setArgumentsString('--regenerate --overwrite') ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityRegenerateOverwrite') ->configureDatabase(false) - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_regenerate_xml' => [MakerTestDetails::createTest( @@ -1279,7 +1287,7 @@ public function getCommandEntityTests() "dir: '%kernel.project_dir%/config/doctrine'" ) ->configureDatabase(false) - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_xml_mapping_error_existing' => [MakerTestDetails::createTest( @@ -1301,9 +1309,9 @@ public function getCommandEntityTests() ->configureDatabase(false) ->setCommandAllowedToFail(true) ->assert(function (string $output, string $directory) { - $this->assertContains('Only annotation mapping is supported', $output); + $this->assertStringContainsString('Only annotation mapping is supported', $output); }) - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_xml_mapping_error_new_class' => [MakerTestDetails::createTest( @@ -1325,9 +1333,9 @@ public function getCommandEntityTests() ->configureDatabase(false) ->setCommandAllowedToFail(true) ->assert(function (string $output, string $directory) { - $this->assertContains('Only annotation mapping is supported', $output); + $this->assertStringContainsString('Only annotation mapping is supported', $output); }) - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; yield 'entity_updating_overwrite' => [MakerTestDetails::createTest( @@ -1346,7 +1354,7 @@ public function getCommandEntityTests() ]) ->setArgumentsString('--overwrite') ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntityOverwrite') - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; // see #192 @@ -1361,7 +1369,7 @@ public function getCommandEntityTests() ->setFixtureFilesPath(__DIR__.'/../fixtures/MakeEntitySubNamespaceMatchingEntity') ->configureDatabase() ->updateSchemaAfterCommand() - ->setRequiredPhpVersion(70100) + ->setRequiredPhpVersion(70100), ]; } @@ -1423,7 +1431,7 @@ public function registerBundles() { return [ new FrameworkBundle(), - new MakerBundle() + new MakerBundle(), ]; } diff --git a/tests/Security/InteractiveSecurityHelperTest.php b/tests/Security/InteractiveSecurityHelperTest.php index a6d2929d6..37d9dd2ac 100644 --- a/tests/Security/InteractiveSecurityHelperTest.php +++ b/tests/Security/InteractiveSecurityHelperTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Security; use PHPUnit\Framework\TestCase; @@ -66,11 +75,10 @@ public function getFirewallNameTests() ]; } - /** - * @expectedException \Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException - */ public function testGuessEntryPointWithNonExistingFirewallThrowsException() { + $this->expectException(\Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException::class); + /** @var SymfonyStyle|\PHPUnit_Framework_MockObject_MockObject $io */ $io = $this->createMock(SymfonyStyle::class); @@ -115,7 +123,7 @@ public function getEntryPointTests() true, ]; - yield 'one_authenticator' => [ + yield 'one_authenticator_entry_point' => [ ['security' => ['firewalls' => ['main' => ['guard' => ['entry_point' => 'App\\Security\\Authenticator', 'authenticators' => ['App\\Security\\Authenticator']]]]]], 'main', ]; @@ -184,28 +192,28 @@ public function getUsernameFieldsTest() yield 'guess_with_providers' => [ 'providers' => ['app_provider' => ['entity' => ['property' => 'userEmail']]], 'expectedUsernameField' => 'userEmail', - true + true, ]; yield 'guess_with_providers_and_custom_repository_method' => [ 'providers' => ['app_provider' => ['entity' => null]], 'expectedUsernameField' => 'email', true, - FixtureClass::class + FixtureClass::class, ]; yield 'guess_fixture_class' => [ 'providers' => [], 'expectedUsernameField' => 'email', true, - FixtureClass::class + FixtureClass::class, ]; yield 'guess_fixture_class_2' => [ 'providers' => [], 'expectedUsernameField' => 'username', true, - FixtureClass2::class + FixtureClass2::class, ]; yield 'guess_fixture_class_3' => [ @@ -213,7 +221,7 @@ public function getUsernameFieldsTest() 'expectedUsernameField' => 'username', false, FixtureClass3::class, - ['username', 'email'] + ['username', 'email'], ]; } } @@ -232,4 +240,4 @@ class FixtureClass3 { private $username; private $email; -} \ No newline at end of file +} diff --git a/tests/Security/SecurityConfigUpdaterTest.php b/tests/Security/SecurityConfigUpdaterTest.php index 7a778ecea..796d581df 100644 --- a/tests/Security/SecurityConfigUpdaterTest.php +++ b/tests/Security/SecurityConfigUpdaterTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Security; use PHPUnit\Framework\TestCase; @@ -55,13 +64,13 @@ public function getUserClassTests() yield 'model_email_password_existing_providers' => [ new UserClassConfiguration(false, 'email', true), 'model_email_password_existing_providers.yaml', - 'multiple_providers_security.yaml' + 'multiple_providers_security.yaml', ]; yield 'empty_source_model_email_password' => [ new UserClassConfiguration(false, 'email', true), 'empty_source_model_email_with_password.yaml', - 'empty_security.yaml' + 'empty_security.yaml', ]; } @@ -85,7 +94,7 @@ public function getAuthenticatorTests() null, 'empty_source.yaml', 'empty_security.yaml', - false + false, ]; yield 'simple_security' => [ @@ -93,7 +102,7 @@ public function getAuthenticatorTests() null, 'simple_security_source.yaml', 'simple_security.yaml', - false + false, ]; yield 'simple_security_with_firewalls' => [ @@ -101,7 +110,7 @@ public function getAuthenticatorTests() null, 'simple_security_with_firewalls.yaml', 'simple_security_with_firewalls.yaml', - false + false, ]; yield 'simple_security_with_firewalls_and_authenticator' => [ @@ -109,7 +118,7 @@ public function getAuthenticatorTests() 'App\\Security\\AppCustomAuthenticator', 'simple_security_with_firewalls_and_authenticator.yaml', 'simple_security_with_firewalls_and_authenticator.yaml', - false + false, ]; yield 'simple_security_with_firewalls_and_logout' => [ @@ -117,7 +126,7 @@ public function getAuthenticatorTests() 'App\\Security\\AppCustomAuthenticator', 'simple_security_with_firewalls_and_logout.yaml', 'simple_security_with_firewalls_and_logout.yaml', - true + true, ]; } -} \ No newline at end of file +} diff --git a/tests/Security/SecurityControllerBuilderTest.php b/tests/Security/SecurityControllerBuilderTest.php index e194d3f08..8ca761c80 100644 --- a/tests/Security/SecurityControllerBuilderTest.php +++ b/tests/Security/SecurityControllerBuilderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Security; use PHPUnit\Framework\TestCase; @@ -10,7 +19,7 @@ class SecurityControllerBuilderTest extends TestCase { public function testAddLoginMethod() { - $source = file_get_contents(__DIR__.'/fixtures/source/SecurityController.php'); + $source = file_get_contents(__DIR__.'/fixtures/source/SecurityController.php'); $expectedSource = file_get_contents(__DIR__.'/fixtures/expected/SecurityController_login.php'); $manipulator = new ClassSourceManipulator($source); @@ -23,7 +32,7 @@ public function testAddLoginMethod() public function testLogoutMethod() { - $source = file_get_contents(__DIR__.'/fixtures/source/SecurityController.php'); + $source = file_get_contents(__DIR__.'/fixtures/source/SecurityController.php'); $expectedSource = file_get_contents(__DIR__.'/fixtures/expected/SecurityController_logout.php'); $manipulator = new ClassSourceManipulator($source); @@ -36,7 +45,7 @@ public function testLogoutMethod() public function testLoginAndLogoutMethod() { - $source = file_get_contents(__DIR__.'/fixtures/source/SecurityController.php'); + $source = file_get_contents(__DIR__.'/fixtures/source/SecurityController.php'); $expectedSource = file_get_contents(__DIR__.'/fixtures/expected/SecurityController_login_logout.php'); $manipulator = new ClassSourceManipulator($source); @@ -47,4 +56,4 @@ public function testLoginAndLogoutMethod() $this->assertSame($expectedSource, $manipulator->getSourceCode()); } -} \ No newline at end of file +} diff --git a/tests/Security/UserClassBuilderTest.php b/tests/Security/UserClassBuilderTest.php index 3b29c8e40..24cb26e83 100644 --- a/tests/Security/UserClassBuilderTest.php +++ b/tests/Security/UserClassBuilderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Security; use PHPUnit\Framework\TestCase; @@ -36,37 +45,37 @@ public function getUserInterfaceTests() { yield 'entity_email_password' => [ new UserClassConfiguration(true, 'email', true), - 'UserEntityEmailWithPassword.php' + 'UserEntityEmailWithPassword.php', ]; yield 'entity_username_password' => [ new UserClassConfiguration(true, 'username', true), - 'UserEntityUsernameWithPassword.php' + 'UserEntityUsernameWithPassword.php', ]; yield 'entity_user_name_password' => [ new UserClassConfiguration(true, 'user_name', true), - 'UserEntityUser_nameWithPassword.php' + 'UserEntityUser_nameWithPassword.php', ]; yield 'entity_username_no_password' => [ new UserClassConfiguration(true, 'username', false), - 'UserEntityUsernameNoPassword.php' + 'UserEntityUsernameNoPassword.php', ]; yield 'model_email_password' => [ new UserClassConfiguration(false, 'email', true), - 'UserModelEmailWithPassword.php' + 'UserModelEmailWithPassword.php', ]; yield 'model_username_password' => [ new UserClassConfiguration(false, 'username', true), - 'UserModelUsernameWithPassword.php' + 'UserModelUsernameWithPassword.php', ]; yield 'model_username_no_password' => [ new UserClassConfiguration(false, 'username', false), - 'UserModelUsernameNoPassword.php' + 'UserModelUsernameNoPassword.php', ]; } -} \ No newline at end of file +} diff --git a/tests/StrTest.php b/tests/StrTest.php index 0b41e9dc4..cd639aa5c 100644 --- a/tests/StrTest.php +++ b/tests/StrTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests; use PHPUnit\Framework\TestCase; diff --git a/tests/Util/AutoloaderUtilTest.php b/tests/Util/AutoloaderUtilTest.php index c95ba77a2..bfc65baf0 100644 --- a/tests/Util/AutoloaderUtilTest.php +++ b/tests/Util/AutoloaderUtilTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Util; use Composer\Autoload\ClassLoader; @@ -76,7 +85,7 @@ private function createComposerAutoloaderFinder(array $composerJsonParams = null foreach ($composerJsonParams['autoload'] as $psr => $dirs) { foreach ($dirs as $prefix => $path) { - if ($psr == 'psr-4') { + if ('psr-4' === $psr) { $classLoader->addPsr4($prefix, self::$currentRootDir.$path); } else { $classLoader->add($prefix, self::$currentRootDir.$path); diff --git a/tests/Util/ClassSourceManipulatorTest.php b/tests/Util/ClassSourceManipulatorTest.php index 07e2b3d4e..96fd43f1b 100644 --- a/tests/Util/ClassSourceManipulatorTest.php +++ b/tests/Util/ClassSourceManipulatorTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Util; use PHPUnit\Framework\TestCase; @@ -34,7 +43,7 @@ public function getAddPropertyTests() 'User_simple.php', 'fooProp', [], - 'User_simple.php' + 'User_simple.php', ]; yield 'with_no_properties_and_comment' => [ @@ -42,23 +51,23 @@ public function getAddPropertyTests() 'fooProp', [ '@var string', - '@internal' + '@internal', ], - 'User_no_props.php' + 'User_no_props.php', ]; yield 'no_properties_and_constants' => [ 'User_no_props_constants.php', 'fooProp', [], - 'User_no_props_constants.php' + 'User_no_props_constants.php', ]; yield 'property_empty_class' => [ 'User_empty.php', 'fooProp', [], - 'User_empty.php' + 'User_empty.php', ]; } @@ -85,7 +94,7 @@ public function getAddGetterTests() 'fooProp', 'string', [], - 'User_simple.php' + 'User_simple.php', ]; yield 'getter_no_props_comments' => [ @@ -94,9 +103,9 @@ public function getAddGetterTests() 'string', [ '@return string', - '@internal' + '@internal', ], - 'User_no_props.php' + 'User_no_props.php', ]; yield 'getter_empty_class' => [ @@ -104,7 +113,7 @@ public function getAddGetterTests() 'fooProp', 'string', [], - 'User_empty.php' + 'User_empty.php', ]; } @@ -132,7 +141,7 @@ public function getAddSetterTests() 'string', false, [], - 'User_simple.php' + 'User_simple.php', ]; yield 'setter_no_props_comments' => [ @@ -142,9 +151,9 @@ public function getAddSetterTests() true, [ '@param string $fooProp', - '@internal' + '@internal', ], - 'User_no_props.php' + 'User_no_props.php', ]; yield 'setter_empty_class' => [ @@ -153,7 +162,7 @@ public function getAddSetterTests() 'string', false, [], - 'User_empty.php' + 'User_empty.php', ]; } @@ -175,7 +184,7 @@ public function getAnnotationTests() yield 'empty_annotation' => [ '@ORM\Column', [], - '@ORM\Column()' + '@ORM\Column()', ]; yield 'complex_annotation' => [ @@ -185,7 +194,7 @@ public function getAnnotationTests() 'length' => 10, 'nullable' => false, ], - '@ORM\Column(name="firstName", length=10, nullable=false)' + '@ORM\Column(name="firstName", length=10, nullable=false)', ]; } @@ -212,9 +221,9 @@ public function getAddEntityFieldTests() 'type' => 'string', 'length' => 255, 'nullable' => false, - 'options' => ['comment' => 'new field'] + 'options' => ['comment' => 'new field'], ], - 'User_simple.php' + 'User_simple.php', ]; yield 'entity_add_datetime' => [ @@ -224,7 +233,7 @@ public function getAddEntityFieldTests() 'type' => 'datetime', 'nullable' => true, ], - 'User_simple_datetime.php' + 'User_simple_datetime.php', ]; yield 'entity_field_property_already_exists' => [ @@ -235,7 +244,7 @@ public function getAddEntityFieldTests() 'length' => 255, 'nullable' => false, ], - 'User_simple_prop_already_exists.php' + 'User_simple_prop_already_exists.php', ]; yield 'entity_field_property_zero' => [ @@ -246,7 +255,7 @@ public function getAddEntityFieldTests() 'precision' => 6, 'scale' => 0, ], - 'User_simple_prop_zero.php' + 'User_simple_prop_zero.php', ]; } @@ -273,7 +282,7 @@ public function getAddManyToOneRelationTests() ->setPropertyName('category') ->setTargetClassName('App\Entity\Category') ->setTargetPropertyName('foods') - ->setIsNullable(false) + ->setIsNullable(false), ]; yield 'many_to_one_nullable' => [ @@ -283,7 +292,7 @@ public function getAddManyToOneRelationTests() ->setPropertyName('category') ->setTargetClassName('App\Entity\Category') ->setTargetPropertyName('foods') - ->setIsNullable(true) + ->setIsNullable(true), ]; yield 'many_to_one_other_namespace' => [ @@ -293,7 +302,7 @@ public function getAddManyToOneRelationTests() ->setPropertyName('category') ->setTargetClassName('Foo\Entity\Category') ->setTargetPropertyName('foods') - ->setIsNullable(true) + ->setIsNullable(true), ]; yield 'many_to_one_empty_other_namespace' => [ @@ -303,7 +312,7 @@ public function getAddManyToOneRelationTests() ->setPropertyName('category') ->setTargetClassName('Foo\Entity\Category') ->setTargetPropertyName('foods') - ->setIsNullable(true) + ->setIsNullable(true), ]; yield 'many_to_one_no_inverse' => [ @@ -314,7 +323,7 @@ public function getAddManyToOneRelationTests() ->setTargetClassName('App\Entity\Category') ->setTargetPropertyName('foods') ->setIsNullable(true) - ->setMapInverseRelation(false) + ->setMapInverseRelation(false), ]; } @@ -341,7 +350,7 @@ public function getAddOneToManyRelationTests() ->setPropertyName('avatarPhotos') ->setTargetClassName('App\Entity\UserAvatarPhoto') ->setTargetPropertyName('user') - ->setOrphanRemoval(false) + ->setOrphanRemoval(false), ]; // interesting also because the source file has its @@ -353,7 +362,7 @@ public function getAddOneToManyRelationTests() ->setPropertyName('avatarPhotos') ->setTargetClassName('App\Entity\UserAvatarPhoto') ->setTargetPropertyName('user') - ->setOrphanRemoval(false) + ->setOrphanRemoval(false), ]; yield 'one_to_many_orphan_removal' => [ @@ -363,7 +372,7 @@ public function getAddOneToManyRelationTests() ->setPropertyName('avatarPhotos') ->setTargetClassName('App\Entity\UserAvatarPhoto') ->setTargetPropertyName('user') - ->setOrphanRemoval(true) + ->setOrphanRemoval(true), ]; // todo test existing constructor @@ -392,7 +401,7 @@ public function getAddManyToManyRelationTests() ->setPropertyName('recipes') ->setTargetClassName('App\Entity\Recipe') ->setTargetPropertyName('foods') - ->setIsOwning(true) + ->setIsOwning(true), ]; yield 'many_to_many_inverse' => [ @@ -402,10 +411,10 @@ public function getAddManyToManyRelationTests() ->setPropertyName('recipes') ->setTargetClassName('App\Entity\Recipe') ->setTargetPropertyName('foods') - ->setIsOwning(false) + ->setIsOwning(false), ]; - yield 'many_to_many_owning' => [ + yield 'many_to_many_owning_inverse' => [ 'User_simple.php', 'User_simple_no_inverse.php', (new RelationManyToMany()) @@ -413,7 +422,7 @@ public function getAddManyToManyRelationTests() ->setTargetClassName('App\Entity\Recipe') ->setTargetPropertyName('foods') ->setIsOwning(true) - ->setMapInverseRelation(false) + ->setMapInverseRelation(false), ]; } @@ -441,7 +450,7 @@ public function getAddOneToOneRelationTests() ->setTargetClassName('App\Entity\UserProfile') ->setTargetPropertyName('user') ->setIsNullable(true) - ->setIsOwning(true) + ->setIsOwning(true), ]; // a relationship to yourself - return type is self @@ -453,7 +462,7 @@ public function getAddOneToOneRelationTests() ->setTargetClassName('App\Entity\User') ->setTargetPropertyName('user') ->setIsNullable(true) - ->setIsOwning(true) + ->setIsOwning(true), ]; yield 'one_to_one_inverse' => [ @@ -464,7 +473,7 @@ public function getAddOneToOneRelationTests() ->setTargetClassName('App\Entity\User') ->setTargetPropertyName('userProfile') ->setIsNullable(true) - ->setIsOwning(false) + ->setIsOwning(false), ]; yield 'one_to_one_inverse_not_nullable' => [ @@ -475,7 +484,7 @@ public function getAddOneToOneRelationTests() ->setTargetClassName('App\Entity\User') ->setTargetPropertyName('userProfile') ->setIsNullable(false) - ->setIsOwning(false) + ->setIsOwning(false), ]; yield 'one_to_one_no_inverse' => [ @@ -487,7 +496,7 @@ public function getAddOneToOneRelationTests() //->setTargetPropertyName('user') ->setIsNullable(true) ->setIsOwning(true) - ->setMapInverseRelation(false) + ->setMapInverseRelation(false), ]; yield 'one_to_one_no_inverse_not_nullable' => [ @@ -499,7 +508,7 @@ public function getAddOneToOneRelationTests() //->setTargetPropertyName('user') ->setIsNullable(false) ->setIsOwning(true) - ->setMapInverseRelation(false) + ->setMapInverseRelation(false), ]; yield 'avoid_duplicate_use_statement' => [ @@ -510,7 +519,7 @@ public function getAddOneToOneRelationTests() ->setTargetClassName('App\OtherEntity\UserProfile') ->setTargetPropertyName('user') ->setIsNullable(true) - ->setIsOwning(true) + ->setIsOwning(true), ]; yield 'avoid_duplicate_use_statement_with_alias' => [ @@ -521,7 +530,7 @@ public function getAddOneToOneRelationTests() ->setTargetClassName('App\OtherEntity\Category') ->setTargetPropertyName('user') ->setIsNullable(true) - ->setIsOwning(true) + ->setIsOwning(true), ]; } @@ -595,7 +604,7 @@ public function testAddAnnotationToClass(string $source, string $expectedSource) { $manipulator = new ClassSourceManipulator($source); $manipulator->addAnnotationToClass('Bar\\SomeAnnotation', [ - 'message' => 'Foo' + 'message' => 'Foo', ]); $this->assertEquals($expectedSource, $manipulator->getSourceCode()); diff --git a/tests/Util/ComposerAutoloaderFinderTest.php b/tests/Util/ComposerAutoloaderFinderTest.php index 5adc155cc..d4868cf2e 100644 --- a/tests/Util/ComposerAutoloaderFinderTest.php +++ b/tests/Util/ComposerAutoloaderFinderTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Util; use Composer\Autoload\ClassLoader; @@ -38,11 +47,10 @@ public function testGetClassLoader($psr0, $psr4) $this->assertInstanceOf(ClassLoader::class, $loader, 'Wrong ClassLoader found'); } - /** - * @expectedException \Exception - */ public function testGetClassLoaderWhenItIsEmpty() { + $this->expectException(\Exception::class); + self::$getSplAutoloadFunctions = function () { return []; }; @@ -77,5 +85,5 @@ private function setupAutoloadFunctions($psr0, $psr4) function spl_autoload_functions() { - return call_user_func_array(ComposerAutoloaderFinderTest::$getSplAutoloadFunctions, func_get_args()); + return \call_user_func_array(ComposerAutoloaderFinderTest::$getSplAutoloadFunctions, \func_get_args()); } diff --git a/tests/Util/YamlSourceManipulatorTest.php b/tests/Util/YamlSourceManipulatorTest.php index 01d66fa20..5e01d6ce6 100644 --- a/tests/Util/YamlSourceManipulatorTest.php +++ b/tests/Util/YamlSourceManipulatorTest.php @@ -1,5 +1,14 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests\Util; use PHPUnit\Framework\TestCase; @@ -55,7 +64,7 @@ private function getYamlDataTests() yield $file->getFilename() => [ 'source' => rtrim($source, "\n"), 'newData' => $data, - 'expectedSource' => ltrim($expected, "\n") + 'expectedSource' => ltrim($expected, "\n"), ]; } @@ -87,13 +96,13 @@ public function getYamlDataTestsWindowsSlashes() private function createLogger(): Logger { - return new Logger(LogLevel::DEBUG, 'php://stdout', function(string $level, string $message, array $context) { + return new Logger(LogLevel::DEBUG, 'php://stdout', function (string $level, string $message, array $context) { $maxLen = max(array_map('strlen', array_keys($context))); foreach ($context as $key => $val) { $message .= sprintf(sprintf( "\n %s%s: %s", - str_repeat(' ', $maxLen - strlen($key)), + str_repeat(' ', $maxLen - \strlen($key)), $key, $val )); @@ -102,4 +111,4 @@ private function createLogger(): Logger return $message."\n\n"; }); } -} \ No newline at end of file +} diff --git a/tests/Util/fixtures/add_one_to_one_relation/UserProfile_simple_inverse.php b/tests/Util/fixtures/add_one_to_one_relation/UserProfile_simple_inverse.php index cd468b5d4..900a6a7c5 100644 --- a/tests/Util/fixtures/add_one_to_one_relation/UserProfile_simple_inverse.php +++ b/tests/Util/fixtures/add_one_to_one_relation/UserProfile_simple_inverse.php @@ -36,8 +36,8 @@ public function setUser(?User $user): self $this->user = $user; // set (or unset) the owning side of the relation if necessary - $newUserProfile = $user === null ? null : $this; - if ($newUserProfile !== $user->getUserProfile()) { + $newUserProfile = null === $user ? null : $this; + if ($user->getUserProfile() !== $newUserProfile) { $user->setUserProfile($newUserProfile); } diff --git a/tests/Util/fixtures/add_one_to_one_relation/UserProfile_simple_inverse_not_nullable.php b/tests/Util/fixtures/add_one_to_one_relation/UserProfile_simple_inverse_not_nullable.php index d96b033fc..d44c773a3 100644 --- a/tests/Util/fixtures/add_one_to_one_relation/UserProfile_simple_inverse_not_nullable.php +++ b/tests/Util/fixtures/add_one_to_one_relation/UserProfile_simple_inverse_not_nullable.php @@ -36,7 +36,7 @@ public function setUser(User $user): self $this->user = $user; // set the owning side of the relation if necessary - if ($this !== $user->getUserProfile()) { + if ($user->getUserProfile() !== $this) { $user->setUserProfile($this); } diff --git a/tests/ValidatorTest.php b/tests/ValidatorTest.php index 4415626bf..386aad3ce 100644 --- a/tests/ValidatorTest.php +++ b/tests/ValidatorTest.php @@ -1,10 +1,19 @@ + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Symfony\Bundle\MakerBundle\Tests; use PHPUnit\Framework\TestCase; -use Symfony\Bundle\MakerBundle\Validator; use Symfony\Bundle\MakerBundle\Exception\RuntimeCommandException; +use Symfony\Bundle\MakerBundle\Validator; class ValidatorTest extends TestCase { @@ -66,7 +75,7 @@ public function testInvalidClassName() public function testInvalidEncodingInClassName() { $this->expectException(RuntimeCommandException::class); - $this->expectExceptionMessage(sprintf('"%sController" is not a UTF-8-encoded string.', chr(0xA6))); + $this->expectExceptionMessage(sprintf('"%sController" is not a UTF-8-encoded string.', \chr(0xA6))); Validator::validateClassName(mb_convert_encoding('ŚController', 'ISO-8859-2', 'UTF-8')); } } diff --git a/tests/fixtures/MakeAuthenticatorLoginFormCustomUsernameField/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormCustomUsernameField/tests/SecurityControllerTest.php index 9c0daca20..9ef67623f 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormCustomUsernameField/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormCustomUsernameField/tests/SecurityControllerTest.php @@ -10,13 +10,13 @@ class SecurityControllerTest extends WebTestCase public function testCommand() { $authenticatorReflection = new \ReflectionClass(AppCustomAuthenticator::class); - $constructorParameters = $authenticatorReflection->getConstructor()->getParameters(); + $constructorParameters = $authenticatorReflection->getConstructor()->getParameters(); $this->assertSame('urlGenerator', $constructorParameters[0]->getName()); // assert authenticator is injected - $this->assertEquals(3, \count($constructorParameters)); + $this->assertCount(3, $constructorParameters); - $client = self::createClient(); + $client = self::createClient(); $crawler = $client->request('GET', '/login'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); @@ -25,22 +25,22 @@ public function testCommand() $form->setValues( [ 'userEmail' => 'bar', - 'password' => 'foo', + 'password' => 'foo', ] ); $client->submit($form); $this->assertEquals(302, $client->getResponse()->getStatusCode()); $client->followRedirect(); - $this->assertContains('Invalid credentials.', $client->getResponse()->getContent()); + $this->assertStringContainsString('Invalid credentials.', $client->getResponse()->getContent()); $form->setValues( [ 'userEmail' => 'test@symfony.com', - 'password' => 'test@symfony.com', + 'password' => 'test@symfony.com', ] ); $client->submit($form); - $this->assertContains('TODO: provide a valid redirect', $client->getResponse()->getContent()); + $this->assertStringContainsString('TODO: provide a valid redirect', $client->getResponse()->getContent()); } } diff --git a/tests/fixtures/MakeAuthenticatorLoginFormExistingController/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormExistingController/tests/SecurityControllerTest.php index 93e60d559..a1081f308 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormExistingController/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormExistingController/tests/SecurityControllerTest.php @@ -13,7 +13,7 @@ public function testCommand() { $this->assertTrue(method_exists(SecurityController::class, 'login')); - $client = self::createClient(); + $client = self::createClient(); $crawler = $client->request('GET', '/login'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); @@ -31,7 +31,7 @@ public function testCommand() $form = $crawler->filter('form')->form(); $form->setValues( [ - 'email' => 'test@symfony.com', + 'email' => 'test@symfony.com', 'password' => 'foo', ] ); @@ -40,16 +40,16 @@ public function testCommand() $this->assertEquals(302, $client->getResponse()->getStatusCode()); $client->followRedirect(); $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertContains('Invalid credentials.', $client->getResponse()->getContent()); + $this->assertStringContainsString('Invalid credentials.', $client->getResponse()->getContent()); $form->setValues( [ - 'email' => 'test@symfony.com', + 'email' => 'test@symfony.com', 'password' => 'password', ] ); $client->submit($form); - $this->assertContains('TODO: provide a valid redirect', $client->getResponse()->getContent()); + $this->assertStringContainsString('TODO: provide a valid redirect', $client->getResponse()->getContent()); } } diff --git a/tests/fixtures/MakeAuthenticatorLoginFormUserEntity/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormUserEntity/tests/SecurityControllerTest.php index 737c80af6..65053f229 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormUserEntity/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormUserEntity/tests/SecurityControllerTest.php @@ -16,9 +16,9 @@ public function testCommand() $this->assertSame('entityManager', $constructorParameters[0]->getName()); // assert authenticator is injected - $this->assertEquals(4, \count($constructorParameters)); + $this->assertCount(4, $constructorParameters); - $client = self::createClient(); + $client = self::createClient(); $crawler = $client->request('GET', '/login'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); @@ -42,24 +42,24 @@ public function testCommand() ); $crawler = $client->submit($form); - if ($client->getResponse()->getStatusCode() === 500) { + if (500 === $client->getResponse()->getStatusCode()) { $this->assertEquals('', $crawler->filter('h1.exception-message')->text()); } $this->assertEquals(302, $client->getResponse()->getStatusCode()); $client->followRedirect(); $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertContains('Invalid credentials.', $client->getResponse()->getContent()); + $this->assertStringContainsString('Invalid credentials.', $client->getResponse()->getContent()); $form->setValues( [ - 'userEmail' => 'test@symfony.com', + 'userEmail' => 'test@symfony.com', 'password' => 'password', ] ); $client->submit($form); - $this->assertContains('TODO: provide a valid redirect', $client->getResponse()->getContent()); + $this->assertStringContainsString('TODO: provide a valid redirect', $client->getResponse()->getContent()); $this->assertNotNull($token = $client->getContainer()->get('security.token_storage')->getToken()); $this->assertInstanceOf(User::class, $token->getUser()); } diff --git a/tests/fixtures/MakeAuthenticatorLoginFormUserEntityLogout/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormUserEntityLogout/tests/SecurityControllerTest.php index a1aaa1776..b6de0a4aa 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormUserEntityLogout/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormUserEntityLogout/tests/SecurityControllerTest.php @@ -16,9 +16,9 @@ public function testCommand() $this->assertSame('entityManager', $constructorParameters[0]->getName()); // assert authenticator is injected - $this->assertEquals(4, \count($constructorParameters)); + $this->assertCount(4, $constructorParameters); - $client = self::createClient(); + $client = self::createClient(); $crawler = $client->request('GET', '/login'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); @@ -42,24 +42,24 @@ public function testCommand() ); $crawler = $client->submit($form); - if ($client->getResponse()->getStatusCode() === 500) { + if (500 === $client->getResponse()->getStatusCode()) { $this->assertEquals('', $crawler->filter('h1.exception-message')->text()); } $this->assertEquals(302, $client->getResponse()->getStatusCode()); $client->followRedirect(); $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertContains('Invalid credentials.', $client->getResponse()->getContent()); + $this->assertStringContainsString('Invalid credentials.', $client->getResponse()->getContent()); $form->setValues( [ - 'userEmail' => 'test@symfony.com', + 'userEmail' => 'test@symfony.com', 'password' => 'password', ] ); $client->submit($form); - $this->assertContains('TODO: provide a valid redirect', $client->getResponse()->getContent()); + $this->assertStringContainsString('TODO: provide a valid redirect', $client->getResponse()->getContent()); $this->assertNotNull($token = $client->getContainer()->get('security.token_storage')->getToken()); $this->assertInstanceOf(User::class, $token->getUser()); diff --git a/tests/fixtures/MakeAuthenticatorLoginFormUserEntityNoEncoder/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormUserEntityNoEncoder/tests/SecurityControllerTest.php index ddad58dcc..ee07c9987 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormUserEntityNoEncoder/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormUserEntityNoEncoder/tests/SecurityControllerTest.php @@ -16,9 +16,9 @@ public function testCommand() $this->assertSame('entityManager', $constructorParameters[0]->getName()); // assert authenticator is *not* injected - $this->assertEquals(3, \count($constructorParameters)); + $this->assertCount(3, $constructorParameters); - $client = self::createClient(); + $client = self::createClient(); $crawler = $client->request('GET', '/login'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); @@ -36,13 +36,13 @@ public function testCommand() $form = $crawler->filter('form')->form(); $form->setValues( [ - 'email' => 'test@symfony.com', + 'email' => 'test@symfony.com', 'password' => 'foo', ] ); $client->submit($form); - $this->assertContains('TODO: check the credentials', $client->getResponse()->getContent()); + $this->assertStringContainsString('TODO: check the credentials', $client->getResponse()->getContent()); } } diff --git a/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntity/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntity/tests/SecurityControllerTest.php index 9f8a27180..9f6b1723b 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntity/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntity/tests/SecurityControllerTest.php @@ -14,7 +14,7 @@ public function testCommand() $this->assertSame('urlGenerator', $constructorParameters[0]->getName()); // assert authenticator is injected - $this->assertEquals(3, \count($constructorParameters)); + $this->assertCount(3, $constructorParameters); $client = self::createClient(); $crawler = $client->request('GET', '/login'); @@ -24,7 +24,7 @@ public function testCommand() $form = $crawler->filter('form')->form(); $form->setValues( [ - 'email' => 'bar', + 'email' => 'bar', 'password' => 'foo', ] ); @@ -32,15 +32,15 @@ public function testCommand() $this->assertEquals(302, $client->getResponse()->getStatusCode()); $client->followRedirect(); - $this->assertContains('Invalid credentials.', $client->getResponse()->getContent()); + $this->assertStringContainsString('Invalid credentials.', $client->getResponse()->getContent()); $form->setValues( [ - 'email' => 'test@symfony.com', + 'email' => 'test@symfony.com', 'password' => 'test@symfony.com', ] ); $client->submit($form); - $this->assertContains('TODO: provide a valid redirect', $client->getResponse()->getContent()); + $this->assertStringContainsString('TODO: provide a valid redirect', $client->getResponse()->getContent()); } } diff --git a/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntityNoEncoder/tests/SecurityControllerTest.php b/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntityNoEncoder/tests/SecurityControllerTest.php index 12aff1d9d..cef8b357e 100644 --- a/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntityNoEncoder/tests/SecurityControllerTest.php +++ b/tests/fixtures/MakeAuthenticatorLoginFormUserNotEntityNoEncoder/tests/SecurityControllerTest.php @@ -14,7 +14,7 @@ public function testCommand() $this->assertSame('urlGenerator', $constructorParameters[0]->getName()); // assert authenticator is *not* injected - $this->assertEquals(2, \count($constructorParameters)); + $this->assertCount(2, $constructorParameters); $client = self::createClient(); $crawler = $client->request('GET', '/login'); @@ -24,12 +24,12 @@ public function testCommand() $form = $crawler->filter('form')->form(); $form->setValues( [ - 'email' => 'bar', + 'email' => 'bar', 'password' => 'foo', ] ); $client->submit($form); - $this->assertContains('TODO: check the credentials', $client->getResponse()->getContent()); + $this->assertStringContainsString('TODO: check the credentials', $client->getResponse()->getContent()); } } diff --git a/tests/fixtures/MakeCommand/tests/GeneratedCommandTest.php b/tests/fixtures/MakeCommand/tests/GeneratedCommandTest.php index e3b5a0999..ecfb0a001 100644 --- a/tests/fixtures/MakeCommand/tests/GeneratedCommandTest.php +++ b/tests/fixtures/MakeCommand/tests/GeneratedCommandTest.php @@ -16,8 +16,8 @@ public function testCommand() $command = $application->find('app:foo'); $tester = new CommandTester($command); - $tester->execute(array()); + $tester->execute([]); - $this->assertContains('You have a new command', $tester->getDisplay()); + $this->assertStringContainsString('You have a new command', $tester->getDisplay()); } } diff --git a/tests/fixtures/MakeCommandInCustomRootNamespace/tests/GeneratedCommandTest.php b/tests/fixtures/MakeCommandInCustomRootNamespace/tests/GeneratedCommandTest.php index 12eba5a4d..1025e7dee 100644 --- a/tests/fixtures/MakeCommandInCustomRootNamespace/tests/GeneratedCommandTest.php +++ b/tests/fixtures/MakeCommandInCustomRootNamespace/tests/GeneratedCommandTest.php @@ -15,11 +15,11 @@ public function testCommand() $command = $application->find('app:foo'); - $this->assertStringStartsWith('Custom\\', get_class($command)); + $this->assertStringStartsWith('Custom\\', \get_class($command)); $tester = new CommandTester($command); - $tester->execute(array()); + $tester->execute([]); - $this->assertContains('You have a new command', $tester->getDisplay()); + $this->assertStringContainsString('You have a new command', $tester->getDisplay()); } } diff --git a/tests/fixtures/MakeControllerTwig/tests/GeneratedControllerWithTwigTest.php b/tests/fixtures/MakeControllerTwig/tests/GeneratedControllerWithTwigTest.php index f50190666..c1cd3f34d 100644 --- a/tests/fixtures/MakeControllerTwig/tests/GeneratedControllerWithTwigTest.php +++ b/tests/fixtures/MakeControllerTwig/tests/GeneratedControllerWithTwigTest.php @@ -12,7 +12,7 @@ public function testController() $client->request('GET', '/foo/twig'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('Hello FooTwigController', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('Hello FooTwigController', $client->getResponse()->getContent()); } } diff --git a/tests/fixtures/MakeCrud/src/Entity/SweetFood.php b/tests/fixtures/MakeCrud/src/Entity/SweetFood.php index 115e6e9d2..66590eaf7 100644 --- a/tests/fixtures/MakeCrud/src/Entity/SweetFood.php +++ b/tests/fixtures/MakeCrud/src/Entity/SweetFood.php @@ -41,5 +41,4 @@ public function setTitle($title) { $this->title = $title; } - } diff --git a/tests/fixtures/MakeCrud/tests/GeneratedCrudControllerTest.php b/tests/fixtures/MakeCrud/tests/GeneratedCrudControllerTest.php index 81dad9414..576eb328b 100644 --- a/tests/fixtures/MakeCrud/tests/GeneratedCrudControllerTest.php +++ b/tests/fixtures/MakeCrud/tests/GeneratedCrudControllerTest.php @@ -11,15 +11,15 @@ public function testIndexAction() $client = self::createClient(); $crawler = $client->request('GET', '/sweet/food/'); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood index', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood index', $client->getResponse()->getContent()); $newLink = $crawler->filter('a:contains("Create new")')->eq(0)->link(); $crawler = $client->click($newLink); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('New SweetFood', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('New SweetFood', $client->getResponse()->getContent()); $newForm = $crawler->selectButton('Save')->form(); $client->submit($newForm, ['sweet_food[title]' => 'Candy']); @@ -27,14 +27,14 @@ public function testIndexAction() $crawler = $client->followRedirect(); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood index', $client->getResponse()->getContent()); - $this->assertContains('Candy', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood index', $client->getResponse()->getContent()); + $this->assertStringContainsString('Candy', $client->getResponse()->getContent()); $editLink = $crawler->filter('a:contains("edit")')->eq(0)->link(); $crawler = $client->click($editLink); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('Edit SweetFood', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('Edit SweetFood', $client->getResponse()->getContent()); $this->assertGreaterThan(0, $crawler->filter('input[type=text]')->count()); $editForm = $crawler->selectButton('Update')->form(); @@ -43,17 +43,17 @@ public function testIndexAction() $crawler = $client->followRedirect(); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood index', $client->getResponse()->getContent()); - $this->assertContains('Candy edited', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood index', $client->getResponse()->getContent()); + $this->assertStringContainsString('Candy edited', $client->getResponse()->getContent()); $showLink = $crawler->filter('a:contains("show")')->eq(0)->link(); $crawler = $client->click($showLink); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood', $client->getResponse()->getContent()); - $this->assertContains('Candy edited', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood', $client->getResponse()->getContent()); + $this->assertStringContainsString('Candy edited', $client->getResponse()->getContent()); $deleteForm = $crawler->selectButton('Delete')->form(); $client->submit($deleteForm); @@ -61,8 +61,8 @@ public function testIndexAction() $client->followRedirect(); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood index', $client->getResponse()->getContent()); - $this->assertContains('no records found', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood index', $client->getResponse()->getContent()); + $this->assertStringContainsString('no records found', $client->getResponse()->getContent()); } } diff --git a/tests/fixtures/MakeCrudInCustomRootNamespace/tests/GeneratedCrudControllerTest.php b/tests/fixtures/MakeCrudInCustomRootNamespace/tests/GeneratedCrudControllerTest.php index 81dad9414..576eb328b 100644 --- a/tests/fixtures/MakeCrudInCustomRootNamespace/tests/GeneratedCrudControllerTest.php +++ b/tests/fixtures/MakeCrudInCustomRootNamespace/tests/GeneratedCrudControllerTest.php @@ -11,15 +11,15 @@ public function testIndexAction() $client = self::createClient(); $crawler = $client->request('GET', '/sweet/food/'); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood index', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood index', $client->getResponse()->getContent()); $newLink = $crawler->filter('a:contains("Create new")')->eq(0)->link(); $crawler = $client->click($newLink); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('New SweetFood', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('New SweetFood', $client->getResponse()->getContent()); $newForm = $crawler->selectButton('Save')->form(); $client->submit($newForm, ['sweet_food[title]' => 'Candy']); @@ -27,14 +27,14 @@ public function testIndexAction() $crawler = $client->followRedirect(); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood index', $client->getResponse()->getContent()); - $this->assertContains('Candy', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood index', $client->getResponse()->getContent()); + $this->assertStringContainsString('Candy', $client->getResponse()->getContent()); $editLink = $crawler->filter('a:contains("edit")')->eq(0)->link(); $crawler = $client->click($editLink); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('Edit SweetFood', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('Edit SweetFood', $client->getResponse()->getContent()); $this->assertGreaterThan(0, $crawler->filter('input[type=text]')->count()); $editForm = $crawler->selectButton('Update')->form(); @@ -43,17 +43,17 @@ public function testIndexAction() $crawler = $client->followRedirect(); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood index', $client->getResponse()->getContent()); - $this->assertContains('Candy edited', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood index', $client->getResponse()->getContent()); + $this->assertStringContainsString('Candy edited', $client->getResponse()->getContent()); $showLink = $crawler->filter('a:contains("show")')->eq(0)->link(); $crawler = $client->click($showLink); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood', $client->getResponse()->getContent()); - $this->assertContains('Candy edited', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood', $client->getResponse()->getContent()); + $this->assertStringContainsString('Candy edited', $client->getResponse()->getContent()); $deleteForm = $crawler->selectButton('Delete')->form(); $client->submit($deleteForm); @@ -61,8 +61,8 @@ public function testIndexAction() $client->followRedirect(); $this->assertTrue($client->getResponse()->isSuccessful()); - $this->assertContains('', $client->getResponse()->getContent()); - $this->assertContains('SweetFood index', $client->getResponse()->getContent()); - $this->assertContains('no records found', $client->getResponse()->getContent()); + $this->assertStringContainsString('', $client->getResponse()->getContent()); + $this->assertStringContainsString('SweetFood index', $client->getResponse()->getContent()); + $this->assertStringContainsString('no records found', $client->getResponse()->getContent()); } } diff --git a/tests/fixtures/MakeEntity/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntity/tests/GeneratedEntityTest.php index b1bb02d02..50922ddaa 100644 --- a/tests/fixtures/MakeEntity/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntity/tests/GeneratedEntityTest.php @@ -2,9 +2,9 @@ namespace App\Tests; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\User; +use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityExistsInRoot/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityExistsInRoot/tests/GeneratedEntityTest.php index 628e2cec2..9d31ee177 100644 --- a/tests/fixtures/MakeEntityExistsInRoot/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityExistsInRoot/tests/GeneratedEntityTest.php @@ -2,10 +2,10 @@ namespace App\Tests; +use App\Entity\Directory; use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Doctrine\ORM\EntityManager; -use App\Entity\Directory; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityManyToMany/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityManyToMany/tests/GeneratedEntityTest.php index d40e261d3..0b2b0aa1e 100644 --- a/tests/fixtures/MakeEntityManyToMany/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityManyToMany/tests/GeneratedEntityTest.php @@ -2,11 +2,11 @@ namespace App\Tests; +use App\Entity\Course; +use App\Entity\User; use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Doctrine\ORM\EntityManager; -use App\Entity\User; -use App\Entity\Course; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityManyToManyInCustomNamespace/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityManyToManyInCustomNamespace/tests/GeneratedEntityTest.php index 194b0e089..fcc0130da 100644 --- a/tests/fixtures/MakeEntityManyToManyInCustomNamespace/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityManyToManyInCustomNamespace/tests/GeneratedEntityTest.php @@ -2,11 +2,11 @@ namespace App\Tests; +use Custom\Entity\Course; +use Custom\Entity\User; use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Doctrine\ORM\EntityManager; -use Custom\Entity\User; -use Custom\Entity\Course; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { @@ -59,6 +59,6 @@ public function testGeneratedEntity() $this->assertEmpty($course2->getStudents()); // check repository namespace - $this->assertStringStartsWith('Custom\\', get_class($em->getRepository(Course::class))); + $this->assertStringStartsWith('Custom\\', \get_class($em->getRepository(Course::class))); } } diff --git a/tests/fixtures/MakeEntityManyToOne/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityManyToOne/tests/GeneratedEntityTest.php index 6131a0d56..0f4ad20f4 100644 --- a/tests/fixtures/MakeEntityManyToOne/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityManyToOne/tests/GeneratedEntityTest.php @@ -2,11 +2,11 @@ namespace App\Tests; -use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\User; use App\Entity\UserAvatarPhoto; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityManyToOneNoInverse/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityManyToOneNoInverse/tests/GeneratedEntityTest.php index 6fe3f832a..af5e1f900 100644 --- a/tests/fixtures/MakeEntityManyToOneNoInverse/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityManyToOneNoInverse/tests/GeneratedEntityTest.php @@ -2,11 +2,10 @@ namespace App\Tests; -use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\User; use App\Entity\UserAvatarPhoto; +use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityOneToMany/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityOneToMany/tests/GeneratedEntityTest.php index 1b5f7818e..80211a65f 100644 --- a/tests/fixtures/MakeEntityOneToMany/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityOneToMany/tests/GeneratedEntityTest.php @@ -2,11 +2,11 @@ namespace App\Tests; -use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\User; use App\Entity\UserAvatarPhoto; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityOneToOne/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityOneToOne/tests/GeneratedEntityTest.php index fd2bd12a7..6f544e1bb 100644 --- a/tests/fixtures/MakeEntityOneToOne/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityOneToOne/tests/GeneratedEntityTest.php @@ -2,10 +2,10 @@ namespace App\Tests; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\User; use App\Entity\UserProfile; +use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityOverwrite/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityOverwrite/tests/GeneratedEntityTest.php index e683ac322..8873b3a8f 100644 --- a/tests/fixtures/MakeEntityOverwrite/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityOverwrite/tests/GeneratedEntityTest.php @@ -2,11 +2,8 @@ namespace App\Tests; -use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\User; -use App\Entity\UserAvatar; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityRegenerate/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityRegenerate/tests/GeneratedEntityTest.php index b1ba8179b..2d0969990 100644 --- a/tests/fixtures/MakeEntityRegenerate/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityRegenerate/tests/GeneratedEntityTest.php @@ -2,11 +2,11 @@ namespace App\Tests; -use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\User; use App\Entity\UserAvatar; +use Doctrine\Common\Collections\ArrayCollection; +use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityRegenerateEmbedable/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityRegenerateEmbedable/tests/GeneratedEntityTest.php index 146176db5..66d37545e 100644 --- a/tests/fixtures/MakeEntityRegenerateEmbedable/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityRegenerateEmbedable/tests/GeneratedEntityTest.php @@ -2,10 +2,10 @@ namespace App\Tests; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\Food; use App\Entity\Recipe; +use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityRegenerateEmbeddableObject/src/Entity/Currency.php b/tests/fixtures/MakeEntityRegenerateEmbeddableObject/src/Entity/Currency.php index f07c87cd5..b23d57c86 100644 --- a/tests/fixtures/MakeEntityRegenerateEmbeddableObject/src/Entity/Currency.php +++ b/tests/fixtures/MakeEntityRegenerateEmbeddableObject/src/Entity/Currency.php @@ -31,6 +31,7 @@ public function getCurrency() /** * @param string $currency + * * @return Currency */ public function setCurrency($currency) @@ -39,6 +40,4 @@ public function setCurrency($currency) return $this; } - - } diff --git a/tests/fixtures/MakeEntityRegenerateEmbeddableObject/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityRegenerateEmbeddableObject/tests/GeneratedEntityTest.php index 731797430..eb6790735 100644 --- a/tests/fixtures/MakeEntityRegenerateEmbeddableObject/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityRegenerateEmbeddableObject/tests/GeneratedEntityTest.php @@ -2,11 +2,11 @@ namespace App\Tests; -use App\Entity\Invoice; use App\Entity\Currency; +use App\Entity\Invoice; use App\Entity\Money; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityRegenerateOverwrite/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityRegenerateOverwrite/tests/GeneratedEntityTest.php index e683ac322..8873b3a8f 100644 --- a/tests/fixtures/MakeEntityRegenerateOverwrite/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityRegenerateOverwrite/tests/GeneratedEntityTest.php @@ -2,11 +2,8 @@ namespace App\Tests; -use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\User; -use App\Entity\UserAvatar; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityRegenerateXml/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityRegenerateXml/tests/GeneratedEntityTest.php index 9db860a99..4e4fc6456 100644 --- a/tests/fixtures/MakeEntityRegenerateXml/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityRegenerateXml/tests/GeneratedEntityTest.php @@ -2,9 +2,9 @@ namespace App\Tests; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use App\Entity\User; use App\Entity\UserAvatar; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntitySelfReferencing/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntitySelfReferencing/tests/GeneratedEntityTest.php index 7e774f62c..096be0c5f 100644 --- a/tests/fixtures/MakeEntitySelfReferencing/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntitySelfReferencing/tests/GeneratedEntityTest.php @@ -2,10 +2,10 @@ namespace App\Tests; +use App\Entity\User; use Doctrine\Common\Collections\ArrayCollection; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; use Doctrine\ORM\EntityManager; -use App\Entity\User; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntitySubNamespaceMatchingEntity/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntitySubNamespaceMatchingEntity/tests/GeneratedEntityTest.php index 1c030aa4a..38be62541 100644 --- a/tests/fixtures/MakeEntitySubNamespaceMatchingEntity/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntitySubNamespaceMatchingEntity/tests/GeneratedEntityTest.php @@ -2,9 +2,9 @@ namespace App\Tests; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\Product\Category; +use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeEntityUpdate/tests/GeneratedEntityTest.php b/tests/fixtures/MakeEntityUpdate/tests/GeneratedEntityTest.php index 67cad0d13..a3db17da7 100644 --- a/tests/fixtures/MakeEntityUpdate/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeEntityUpdate/tests/GeneratedEntityTest.php @@ -2,9 +2,9 @@ namespace App\Tests; -use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; -use Doctrine\ORM\EntityManager; use App\Entity\User; +use Doctrine\ORM\EntityManager; +use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; class GeneratedEntityTest extends KernelTestCase { diff --git a/tests/fixtures/MakeForm/tests/GeneratedFormTest.php b/tests/fixtures/MakeForm/tests/GeneratedFormTest.php index 0e9881d57..42f30b73f 100644 --- a/tests/fixtures/MakeForm/tests/GeneratedFormTest.php +++ b/tests/fixtures/MakeForm/tests/GeneratedFormTest.php @@ -10,7 +10,7 @@ class GeneratedFormTest extends TypeTestCase public function testGeneratedForm() { $formData = [ - 'field_name' => 'field_value' + 'field_name' => 'field_value', ]; $form = $this->factory->create(FooBarType::class); diff --git a/tests/fixtures/MakeFormEmbedableEntity/src/Entity/Recept.php b/tests/fixtures/MakeFormEmbedableEntity/src/Entity/Recept.php index d7b72fc9a..559f9c5bd 100644 --- a/tests/fixtures/MakeFormEmbedableEntity/src/Entity/Recept.php +++ b/tests/fixtures/MakeFormEmbedableEntity/src/Entity/Recept.php @@ -18,5 +18,4 @@ class Recept * @ORM\Column(type="string", length=255) */ private $steps; - } diff --git a/tests/fixtures/MakeFormEmbedableEntity/tests/GeneratedFormTest.php b/tests/fixtures/MakeFormEmbedableEntity/tests/GeneratedFormTest.php index 08a51588f..bab65fb96 100644 --- a/tests/fixtures/MakeFormEmbedableEntity/tests/GeneratedFormTest.php +++ b/tests/fixtures/MakeFormEmbedableEntity/tests/GeneratedFormTest.php @@ -11,7 +11,7 @@ class GeneratedFormTest extends TypeTestCase public function testGeneratedForm() { $formData = [ - 'title' => 'lemon' + 'title' => 'lemon', ]; $form = $this->factory->create(FoodType::class); diff --git a/tests/fixtures/MakeFormForEntity/src/Entity/Property.php b/tests/fixtures/MakeFormForEntity/src/Entity/Property.php index 4fa14fa53..300d8262a 100644 --- a/tests/fixtures/MakeFormForEntity/src/Entity/Property.php +++ b/tests/fixtures/MakeFormForEntity/src/Entity/Property.php @@ -17,9 +17,10 @@ class Property private $id; /** - * Many Features have One Product. - * @ORM\ManyToOne(targetEntity="App\Entity\SourFood", inversedBy="properties") - * @ORM\JoinColumn(name="sour_food_id", referencedColumnName="id") - */ + * Many Features have One Product. + * + * @ORM\ManyToOne(targetEntity="App\Entity\SourFood", inversedBy="properties") + * @ORM\JoinColumn(name="sour_food_id", referencedColumnName="id") + */ private $sourFood; -} \ No newline at end of file +} diff --git a/tests/fixtures/MakeFormForEntity/tests/GeneratedFormTest.php b/tests/fixtures/MakeFormForEntity/tests/GeneratedFormTest.php index 5ccb84de9..fdce756b5 100644 --- a/tests/fixtures/MakeFormForEntity/tests/GeneratedFormTest.php +++ b/tests/fixtures/MakeFormForEntity/tests/GeneratedFormTest.php @@ -11,7 +11,7 @@ class GeneratedFormTest extends TypeTestCase public function testGeneratedForm() { $formData = [ - 'title' => 'lemon' + 'title' => 'lemon', ]; $form = $this->factory->create(SourFoodType::class); diff --git a/tests/fixtures/MakeFormSTIEntity/src/Entity/SourFood.php b/tests/fixtures/MakeFormSTIEntity/src/Entity/SourFood.php index 09bb081f7..5db3e0408 100644 --- a/tests/fixtures/MakeFormSTIEntity/src/Entity/SourFood.php +++ b/tests/fixtures/MakeFormSTIEntity/src/Entity/SourFood.php @@ -9,5 +9,4 @@ */ class SourFood extends Food { - } diff --git a/tests/fixtures/MakeFormSTIEntity/tests/GeneratedFormTest.php b/tests/fixtures/MakeFormSTIEntity/tests/GeneratedFormTest.php index 5ccb84de9..fdce756b5 100644 --- a/tests/fixtures/MakeFormSTIEntity/tests/GeneratedFormTest.php +++ b/tests/fixtures/MakeFormSTIEntity/tests/GeneratedFormTest.php @@ -11,7 +11,7 @@ class GeneratedFormTest extends TypeTestCase public function testGeneratedForm() { $formData = [ - 'title' => 'lemon' + 'title' => 'lemon', ]; $form = $this->factory->create(SourFoodType::class); diff --git a/tests/fixtures/MakeRegistrationFormEntity/src/Controller/TestingController.php b/tests/fixtures/MakeRegistrationFormEntity/src/Controller/TestingController.php index 022032c27..b92bb7a9d 100644 --- a/tests/fixtures/MakeRegistrationFormEntity/src/Controller/TestingController.php +++ b/tests/fixtures/MakeRegistrationFormEntity/src/Controller/TestingController.php @@ -18,4 +18,4 @@ public function anonymous() { return new Response('Page Success'); } -} \ No newline at end of file +} diff --git a/tests/fixtures/MakeRegistrationFormEntity/src/Security/StubAuthenticator.php b/tests/fixtures/MakeRegistrationFormEntity/src/Security/StubAuthenticator.php index d3da6e224..616e5b828 100644 --- a/tests/fixtures/MakeRegistrationFormEntity/src/Security/StubAuthenticator.php +++ b/tests/fixtures/MakeRegistrationFormEntity/src/Security/StubAuthenticator.php @@ -54,4 +54,4 @@ public function supportsRememberMe() public function start(Request $request, AuthenticationException $authException = null) { } -} \ No newline at end of file +} diff --git a/tests/fixtures/MakeRegistrationFormEntity/tests/RegistrationFormTest.php b/tests/fixtures/MakeRegistrationFormEntity/tests/RegistrationFormTest.php index bd0fb1f20..6cfba5b6e 100644 --- a/tests/fixtures/MakeRegistrationFormEntity/tests/RegistrationFormTest.php +++ b/tests/fixtures/MakeRegistrationFormEntity/tests/RegistrationFormTest.php @@ -2,8 +2,8 @@ namespace App\Tests; -use Doctrine\ORM\EntityManager; use App\Entity\User; +use Doctrine\ORM\EntityManager; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; class RegistrationFormTest extends WebTestCase @@ -55,15 +55,15 @@ public function testRegistrationValidationError() $client->submit($form); $this->assertSame(200, $client->getResponse()->getStatusCode()); - $this->assertContains( + $this->assertStringContainsString( 'There is already an account with this email', $client->getResponse()->getContent() ); - $this->assertContains( + $this->assertStringContainsString( 'Your password should be at least 6 characters', $client->getResponse()->getContent() ); - $this->assertContains( + $this->assertStringContainsString( 'You should agree to our terms.', $client->getResponse()->getContent() ); diff --git a/tests/fixtures/MakeUserEntityPassword/src/Controller/TestingController.php b/tests/fixtures/MakeUserEntityPassword/src/Controller/TestingController.php index 55850b8b0..3c2d2b9c0 100644 --- a/tests/fixtures/MakeUserEntityPassword/src/Controller/TestingController.php +++ b/tests/fixtures/MakeUserEntityPassword/src/Controller/TestingController.php @@ -13,4 +13,4 @@ public function homepage() return new Response('Homepage Success'); } -} \ No newline at end of file +} diff --git a/tests/fixtures/MakeUserEntityPassword/src/Security/AutomaticAuthenticator.php b/tests/fixtures/MakeUserEntityPassword/src/Security/AutomaticAuthenticator.php index 5eff7d570..237079d51 100644 --- a/tests/fixtures/MakeUserEntityPassword/src/Security/AutomaticAuthenticator.php +++ b/tests/fixtures/MakeUserEntityPassword/src/Security/AutomaticAuthenticator.php @@ -26,7 +26,7 @@ public function __construct(EntityManagerInterface $em, RouterInterface $router) public function supports(Request $request) { - return $request->getPathInfo() === '/login' && $request->query->has('email'); + return '/login' === $request->getPathInfo() && $request->query->has('email'); } public function getCredentials(Request $request) @@ -46,7 +46,6 @@ public function checkCredentials($credentials, UserInterface $user) public function onAuthenticationFailure(Request $request, AuthenticationException $exception) { - } public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) @@ -62,4 +61,4 @@ public function supportsRememberMe() public function start(Request $request, AuthenticationException $authException = null) { } -} \ No newline at end of file +} diff --git a/tests/fixtures/MakeUserEntityPassword/tests/GeneratedEntityTest.php b/tests/fixtures/MakeUserEntityPassword/tests/GeneratedEntityTest.php index ac347b193..05560f144 100644 --- a/tests/fixtures/MakeUserEntityPassword/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeUserEntityPassword/tests/GeneratedEntityTest.php @@ -2,8 +2,8 @@ namespace App\Tests; -use Doctrine\ORM\EntityManager; use App\Entity\User; +use Doctrine\ORM\EntityManager; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder; diff --git a/tests/fixtures/MakeUserModelNoPassword/src/Controller/TestingController.php b/tests/fixtures/MakeUserModelNoPassword/src/Controller/TestingController.php index fe76915b7..c26e99884 100644 --- a/tests/fixtures/MakeUserModelNoPassword/src/Controller/TestingController.php +++ b/tests/fixtures/MakeUserModelNoPassword/src/Controller/TestingController.php @@ -13,4 +13,4 @@ public function homepage() return new Response('Homepage Success. Hello: '.$this->getUser()->getUsername()); } -} \ No newline at end of file +} diff --git a/tests/fixtures/MakeUserModelNoPassword/src/Security/AutomaticAuthenticator.php b/tests/fixtures/MakeUserModelNoPassword/src/Security/AutomaticAuthenticator.php index 75e169fb0..337adcef2 100644 --- a/tests/fixtures/MakeUserModelNoPassword/src/Security/AutomaticAuthenticator.php +++ b/tests/fixtures/MakeUserModelNoPassword/src/Security/AutomaticAuthenticator.php @@ -22,7 +22,7 @@ public function __construct(RouterInterface $router) public function supports(Request $request) { - return $request->getPathInfo() === '/login' && $request->query->has('username'); + return '/login' === $request->getPathInfo() && $request->query->has('username'); } public function getCredentials(Request $request) @@ -45,7 +45,6 @@ public function checkCredentials($credentials, UserInterface $user) public function onAuthenticationFailure(Request $request, AuthenticationException $exception) { - } public function onAuthenticationSuccess(Request $request, TokenInterface $token, $providerKey) @@ -61,4 +60,4 @@ public function supportsRememberMe() public function start(Request $request, AuthenticationException $authException = null) { } -} \ No newline at end of file +} diff --git a/tests/fixtures/MakeUserModelNoPassword/tests/GeneratedEntityTest.php b/tests/fixtures/MakeUserModelNoPassword/tests/GeneratedEntityTest.php index 6bed470bd..c806f345b 100644 --- a/tests/fixtures/MakeUserModelNoPassword/tests/GeneratedEntityTest.php +++ b/tests/fixtures/MakeUserModelNoPassword/tests/GeneratedEntityTest.php @@ -2,10 +2,7 @@ namespace App\Tests; -use Doctrine\ORM\EntityManager; -use App\Entity\User; use Symfony\Bundle\FrameworkBundle\Test\WebTestCase; -use Symfony\Component\Security\Core\Encoder\UserPasswordEncoder; class GeneratedEntityTest extends WebTestCase {