From bf13004ef4266a228df4ca6c73f9ed4f89b1dcc3 Mon Sep 17 00:00:00 2001 From: Marco Petersen Date: Wed, 12 Sep 2018 23:22:17 +0300 Subject: [PATCH 1/3] Install PHP-CS-Fixer --- application/.gitignore | 5 + application/.php_cs.dist | 8 ++ application/composer.json | 1 + application/composer.lock | 255 +++++++++++++++++++++++++++++++++++++- application/symfony.lock | 18 +++ 5 files changed, 286 insertions(+), 1 deletion(-) create mode 100644 application/.php_cs.dist diff --git a/application/.gitignore b/application/.gitignore index 9771c24..b3441de 100644 --- a/application/.gitignore +++ b/application/.gitignore @@ -24,3 +24,8 @@ ###> phpunit/phpunit ### /phpunit.xml ###< phpunit/phpunit ### + +###> friendsofphp/php-cs-fixer ### +/.php_cs +/.php_cs.cache +###< friendsofphp/php-cs-fixer ### diff --git a/application/.php_cs.dist b/application/.php_cs.dist new file mode 100644 index 0000000..d80e5d6 --- /dev/null +++ b/application/.php_cs.dist @@ -0,0 +1,8 @@ +setRules([ + '@Symfony' => true, + 'array_syntax' => ['syntax' => 'short'], + ]) +; diff --git a/application/composer.json b/application/composer.json index 803b2ea..c27a986 100644 --- a/application/composer.json +++ b/application/composer.json @@ -26,6 +26,7 @@ "symfony/yaml": "*" }, "require-dev": { + "friendsofphp/php-cs-fixer": "^2.13", "phpunit/phpunit": "^7", "symfony/browser-kit": "*", "symfony/css-selector": "*", diff --git a/application/composer.lock b/application/composer.lock index 7026bef..d191df9 100644 --- a/application/composer.lock +++ b/application/composer.lock @@ -4,7 +4,7 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "46e513d742140ba387e272208c8a9dc9", + "content-hash": "84feb7a6f450a0cebf04372288e07623", "packages": [ { "name": "doctrine/annotations", @@ -4967,6 +4967,112 @@ } ], "packages-dev": [ + { + "name": "composer/semver", + "version": "1.4.2", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/c7cb9a2095a074d131b65a8a0cd294479d785573", + "reference": "c7cb9a2095a074d131b65a8a0cd294479d785573", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.5 || ^5.0.5", + "phpunit/phpunit-mock-objects": "2.3.0 || ^3.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "time": "2016-08-30T16:08:34+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "b8e9745fb9b06ea6664d8872c4505fb16df4611c" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/b8e9745fb9b06ea6664d8872c4505fb16df4611c", + "reference": "b8e9745fb9b06ea6664d8872c4505fb16df4611c", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0", + "psr/log": "^1.0" + }, + "require-dev": { + "phpunit/phpunit": "^4.8.35 || ^5.7 || ^6.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "time": "2018-08-31T19:07:57+00:00" + }, { "name": "easycorp/easy-log-handler", "version": "v1.0.7", @@ -5017,6 +5123,102 @@ ], "time": "2018-07-27T15:41:37+00:00" }, + { + "name": "friendsofphp/php-cs-fixer", + "version": "v2.13.0", + "source": { + "type": "git", + "url": "https://github.com/FriendsOfPHP/PHP-CS-Fixer.git", + "reference": "7136aa4e0c5f912e8af82383775460d906168a10" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/FriendsOfPHP/PHP-CS-Fixer/zipball/7136aa4e0c5f912e8af82383775460d906168a10", + "reference": "7136aa4e0c5f912e8af82383775460d906168a10", + "shasum": "" + }, + "require": { + "composer/semver": "^1.4", + "composer/xdebug-handler": "^1.2", + "doctrine/annotations": "^1.2", + "ext-json": "*", + "ext-tokenizer": "*", + "php": "^5.6 || >=7.0 <7.3", + "php-cs-fixer/diff": "^1.3", + "symfony/console": "^3.2 || ^4.0", + "symfony/event-dispatcher": "^3.0 || ^4.0", + "symfony/filesystem": "^3.0 || ^4.0", + "symfony/finder": "^3.0 || ^4.0", + "symfony/options-resolver": "^3.0 || ^4.0", + "symfony/polyfill-php70": "^1.0", + "symfony/polyfill-php72": "^1.4", + "symfony/process": "^3.0 || ^4.0", + "symfony/stopwatch": "^3.0 || ^4.0" + }, + "conflict": { + "hhvm": "*" + }, + "require-dev": { + "johnkary/phpunit-speedtrap": "^1.1 || ^2.0 || ^3.0", + "justinrainbow/json-schema": "^5.0", + "keradus/cli-executor": "^1.1", + "mikey179/vfsstream": "^1.6", + "php-coveralls/php-coveralls": "^2.1", + "php-cs-fixer/accessible-object": "^1.0", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "^1.0.1", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "^1.0.1", + "phpunit/phpunit": "^5.7.27 || ^6.5.8 || ^7.1", + "phpunitgoodpractices/traits": "^1.5.1", + "symfony/phpunit-bridge": "^4.0" + }, + "suggest": { + "ext-mbstring": "For handling non-UTF8 characters in cache signature.", + "php-cs-fixer/phpunit-constraint-isidenticalstring": "For IsIdenticalString constraint.", + "php-cs-fixer/phpunit-constraint-xmlmatchesxsd": "For XmlMatchesXsd constraint.", + "symfony/polyfill-mbstring": "When enabling `ext-mbstring` is not possible." + }, + "bin": [ + "php-cs-fixer" + ], + "type": "application", + "extra": { + "branch-alias": { + "dev-master": "2.13-dev" + } + }, + "autoload": { + "psr-4": { + "PhpCsFixer\\": "src/" + }, + "classmap": [ + "tests/Test/AbstractFixerTestCase.php", + "tests/Test/AbstractIntegrationCaseFactory.php", + "tests/Test/AbstractIntegrationTestCase.php", + "tests/Test/Assert/AssertTokensTrait.php", + "tests/Test/IntegrationCase.php", + "tests/Test/IntegrationCaseFactory.php", + "tests/Test/IntegrationCaseFactoryInterface.php", + "tests/Test/InternalIntegrationCaseFactory.php", + "tests/TestCase.php" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Dariusz RumiƄski", + "email": "dariusz.ruminski@gmail.com" + }, + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" + } + ], + "description": "A tool to automatically fix PHP code style", + "time": "2018-08-23T13:15:44+00:00" + }, { "name": "myclabs/deep-copy", "version": "1.8.1", @@ -5218,6 +5420,57 @@ "description": "Library for handling version information and constraints", "time": "2018-07-08T19:19:57+00:00" }, + { + "name": "php-cs-fixer/diff", + "version": "v1.3.0", + "source": { + "type": "git", + "url": "https://github.com/PHP-CS-Fixer/diff.git", + "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/PHP-CS-Fixer/diff/zipball/78bb099e9c16361126c86ce82ec4405ebab8e756", + "reference": "78bb099e9c16361126c86ce82ec4405ebab8e756", + "shasum": "" + }, + "require": { + "php": "^5.6 || ^7.0" + }, + "require-dev": { + "phpunit/phpunit": "^5.7.23 || ^6.4.3", + "symfony/process": "^3.3" + }, + "type": "library", + "autoload": { + "classmap": [ + "src/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "BSD-3-Clause" + ], + "authors": [ + { + "name": "Kore Nordmann", + "email": "mail@kore-nordmann.de" + }, + { + "name": "Sebastian Bergmann", + "email": "sebastian@phpunit.de" + }, + { + "name": "SpacePossum" + } + ], + "description": "sebastian/diff v2 backport support for PHP5.6", + "homepage": "https://github.com/PHP-CS-Fixer", + "keywords": [ + "diff" + ], + "time": "2018-02-15T16:58:55+00:00" + }, { "name": "phpspec/prophecy", "version": "1.8.0", diff --git a/application/symfony.lock b/application/symfony.lock index 7fd2dbe..7bdcc1b 100644 --- a/application/symfony.lock +++ b/application/symfony.lock @@ -1,4 +1,10 @@ { + "composer/semver": { + "version": "1.4.2" + }, + "composer/xdebug-handler": { + "version": "1.3.0" + }, "doctrine/annotations": { "version": "1.0", "recipe": { @@ -80,6 +86,15 @@ "fig/link-util": { "version": "1.0.0" }, + "friendsofphp/php-cs-fixer": { + "version": "2.2", + "recipe": { + "repo": "github.com/symfony/recipes", + "branch": "master", + "version": "2.2", + "ref": "81dee417d2cc60cd1c9d6208dff2ec22a1103e93" + } + }, "jdorn/sql-formatter": { "version": "v1.2.17" }, @@ -107,6 +122,9 @@ "phar-io/version": { "version": "2.0.1" }, + "php-cs-fixer/diff": { + "version": "v1.3.0" + }, "phpdocumentor/reflection-common": { "version": "1.0.1" }, From 60119c5b1bff0f47ed106fb9433b916fca4081e6 Mon Sep 17 00:00:00 2001 From: Marco Petersen Date: Wed, 12 Sep 2018 23:24:48 +0300 Subject: [PATCH 2/3] Create script to run PHP-CS-Fixer --- administration/format-code.sh | 1 + 1 file changed, 1 insertion(+) create mode 100644 administration/format-code.sh diff --git a/administration/format-code.sh b/administration/format-code.sh new file mode 100644 index 0000000..3f4c055 --- /dev/null +++ b/administration/format-code.sh @@ -0,0 +1 @@ +(cd $(dirname $(readlink -f ${0}))/../docker-symfony/ && docker-compose exec php php vendor/bin/php-cs-fixer fix .) From f1b9ffd160aa7cca17f44d2f3f7883a5a62bf74c Mon Sep 17 00:00:00 2001 From: Marco Petersen Date: Wed, 12 Sep 2018 23:25:22 +0300 Subject: [PATCH 3/3] Format code --- .../src/Controller/ActivationInterface.php | 10 +++--- .../src/Controller/CreationInterface.php | 10 +++--- .../src/Controller/DefaultController.php | 10 +++--- .../Controller/DefaultControllerInterface.php | 10 +++--- .../src/Controller/ModificationInterface.php | 6 ++-- .../src/Controller/RegistrationController.php | 21 ++++++------ .../src/Controller/SecurityController.php | 20 ++++++------ .../src/Controller/SourceController.php | 23 +++++++------ .../Controller/SourceControllerInterface.php | 6 ++-- application/src/Entity/AbstractSource.php | 13 ++++---- .../src/Entity/Attribut/ChildsAttribut.php | 17 +++++----- .../Attribut/ChildsAttributeInterface.php | 12 +++---- .../src/Entity/Attribut/IdAttribut.php | 11 +++---- .../Entity/Attribut/IdAttributInterface.php | 6 ++-- .../src/Entity/Attribut/NodeAttribut.php | 12 +++---- .../Entity/Attribut/NodeAttributInterface.php | 10 +++--- .../src/Entity/Attribut/ParentAttribut.php | 11 +++---- .../Attribut/ParentsAttributInterface.php | 10 +++--- .../src/Entity/Attribut/PasswordAttribut.php | 16 +++++----- .../Attribut/PlainPasswordAttribute.php | 11 +++---- .../src/Entity/Attribut/SourceAttribut.php | 18 ++++++----- .../Attribut/SourceAttributInterface.php | 10 +++--- .../src/Entity/Attribut/UsernameAttribut.php | 19 +++++------ application/src/Entity/Configuration.php | 32 +++++++++---------- .../src/Entity/ConfigurationInterface.php | 27 ++++++++-------- application/src/Entity/Node.php | 7 ++-- application/src/Entity/NodeInterface.php | 9 +++--- application/src/Entity/Property.php | 17 ++++------ application/src/Entity/PropertyInterface.php | 10 +++--- application/src/Entity/SourceInterface.php | 4 +-- application/src/Entity/User.php | 15 ++++----- application/src/Entity/UserInterface.php | 4 +-- .../src/Event/Menu/Topbar/UserMenuEvent.php | 16 +++++----- application/src/Form/UserType.php | 18 +++++------ application/src/Menu/Menu.php | 26 +++++++-------- application/src/Repository/UserRepository.php | 4 +-- .../src/Subscriber/UserMenuSubscriber.php | 9 +++--- .../unit/Controller/DefaultControllerTest.php | 22 ++++++------- .../unit/Controller/UserControllerTest.php | 18 +++++------ application/tests/unit/Entity/UserTest.php | 28 ++++++++-------- 40 files changed, 257 insertions(+), 301 deletions(-) diff --git a/application/src/Controller/ActivationInterface.php b/application/src/Controller/ActivationInterface.php index 63d2f7b..5d9f984 100644 --- a/application/src/Controller/ActivationInterface.php +++ b/application/src/Controller/ActivationInterface.php @@ -1,17 +1,15 @@ render("standard/imprint.html.twig"); + return $this->render('standard/imprint.html.twig'); } - + /** * @Route("/", name="homepage") */ public function homepage(): Response { - return $this->render("standard/homepage.html.twig"); + return $this->render('standard/homepage.html.twig'); } } - diff --git a/application/src/Controller/DefaultControllerInterface.php b/application/src/Controller/DefaultControllerInterface.php index 5caa3d1..acf55af 100644 --- a/application/src/Controller/DefaultControllerInterface.php +++ b/application/src/Controller/DefaultControllerInterface.php @@ -1,17 +1,15 @@ user = new User(); $form = $this->createForm(UserType::class, $this->user); @@ -33,11 +29,13 @@ class RegistrationController extends AbstractController if ($form->isSubmitted() && $form->isValid()) { $this->encodePassword($passwordEncoder); $this->saveUser($translator); + return $this->redirectToRoute('login'); } - return $this->render("user/register.html.twig", array( - 'form' => $form->createView() - )); + + return $this->render('user/register.html.twig', [ + 'form' => $form->createView(), + ]); } public function encodePassword(UserPasswordEncoderInterface $passwordEncoder): void @@ -52,10 +50,9 @@ class RegistrationController extends AbstractController $entityManager->persist($this->user); try { $entityManager->flush(); - $this->addFlash('success', $translator->trans('User "%username%" created!',['%username%'=>$this->user->getUsername()])); + $this->addFlash('success', $translator->trans('User "%username%" created!', ['%username%' => $this->user->getUsername()])); } catch (\Exception $exception) { - $this->addFlash('danger', $translator->trans('User "%username%" could not be created!',['%username%'=>$this->user->getUsername()])); + $this->addFlash('danger', $translator->trans('User "%username%" could not be created!', ['%username%' => $this->user->getUsername()])); } } } - diff --git a/application/src/Controller/SecurityController.php b/application/src/Controller/SecurityController.php index 67ab0a4..f61dd31 100644 --- a/application/src/Controller/SecurityController.php +++ b/application/src/Controller/SecurityController.php @@ -1,4 +1,5 @@ getLastAuthenticationError(); if ($error) { - $this->addFlash('danger', $translator->trans($error->getMessageKey(),$error->getMessageData(),'security')); - }else{ + $this->addFlash('danger', $translator->trans($error->getMessageKey(), $error->getMessageData(), 'security')); + } else { $lastUsername = $authenticationUtils->getLastUsername(); - if($lastUsername){ - $this->addFlash('success', $translator->trans('User %user% loged in.',['%user%'=>$lastUsername])); + if ($lastUsername) { + $this->addFlash('success', $translator->trans('User %user% loged in.', ['%user%' => $lastUsername])); } } - return $this->render("user/login.html.twig",[ - 'last_username'=>$authenticationUtils->getLastUsername(), + + return $this->render('user/login.html.twig', [ + 'last_username' => $authenticationUtils->getLastUsername(), ]); } } - diff --git a/application/src/Controller/SourceController.php b/application/src/Controller/SourceController.php index 749204c..d86afb8 100644 --- a/application/src/Controller/SourceController.php +++ b/application/src/Controller/SourceController.php @@ -1,32 +1,35 @@ getChilds(); } - + public function setChilds(ArrayCollection $childs): void { $this->childs = $childs; } - } - diff --git a/application/src/Entity/Attribut/ChildsAttributeInterface.php b/application/src/Entity/Attribut/ChildsAttributeInterface.php index a8bd3af..5e90f15 100644 --- a/application/src/Entity/Attribut/ChildsAttributeInterface.php +++ b/application/src/Entity/Attribut/ChildsAttributeInterface.php @@ -1,15 +1,15 @@ id = $id; } - + public function getId(): int { return $this->id; } } - diff --git a/application/src/Entity/Attribut/IdAttributInterface.php b/application/src/Entity/Attribut/IdAttributInterface.php index 7d1a271..6af8838 100644 --- a/application/src/Entity/Attribut/IdAttributInterface.php +++ b/application/src/Entity/Attribut/IdAttributInterface.php @@ -1,15 +1,13 @@ node = $node; } - + public function getNode(): NodeInterface { return $this->node; } - } - diff --git a/application/src/Entity/Attribut/NodeAttributInterface.php b/application/src/Entity/Attribut/NodeAttributInterface.php index 6f40f66..46217e6 100644 --- a/application/src/Entity/Attribut/NodeAttributInterface.php +++ b/application/src/Entity/Attribut/NodeAttributInterface.php @@ -1,17 +1,15 @@ parents = $parents; } } - diff --git a/application/src/Entity/Attribut/ParentsAttributInterface.php b/application/src/Entity/Attribut/ParentsAttributInterface.php index 59dfdc9..7f37f7c 100644 --- a/application/src/Entity/Attribut/ParentsAttributInterface.php +++ b/application/src/Entity/Attribut/ParentsAttributInterface.php @@ -1,17 +1,15 @@ password; } - - public function setPassword(string $password):void{ + + public function setPassword(string $password): void + { $this->password = $password; } } - diff --git a/application/src/Entity/Attribut/PlainPasswordAttribute.php b/application/src/Entity/Attribut/PlainPasswordAttribute.php index 6438844..102966c 100644 --- a/application/src/Entity/Attribut/PlainPasswordAttribute.php +++ b/application/src/Entity/Attribut/PlainPasswordAttribute.php @@ -1,18 +1,18 @@ plainPassword = $password; } } - diff --git a/application/src/Entity/Attribut/SourceAttribut.php b/application/src/Entity/Attribut/SourceAttribut.php index 0ce4567..5d6f5c7 100644 --- a/application/src/Entity/Attribut/SourceAttribut.php +++ b/application/src/Entity/Attribut/SourceAttribut.php @@ -1,27 +1,29 @@ source; } - - public function setSource(SourceInterface $source):void{ + + public function setSource(SourceInterface $source): void + { $this->source = $source; } } - diff --git a/application/src/Entity/Attribut/SourceAttributInterface.php b/application/src/Entity/Attribut/SourceAttributInterface.php index 3a3e808..a0b72a0 100644 --- a/application/src/Entity/Attribut/SourceAttributInterface.php +++ b/application/src/Entity/Attribut/SourceAttributInterface.php @@ -1,17 +1,15 @@ username; } - - public function setUsername(string $username):void{ + + public function setUsername(string $username): void + { $this->username = \trim($username); } } - diff --git a/application/src/Entity/Configuration.php b/application/src/Entity/Configuration.php index 20c89ee..1e209f9 100644 --- a/application/src/Entity/Configuration.php +++ b/application/src/Entity/Configuration.php @@ -1,48 +1,48 @@ id, $this->username, $this->password, - )); + ]); } /** @see \Serializable::unserialize() */ public function unserialize($serialized) { - list ( + list( $this->id, $this->username, - $this->password, - ) = unserialize($serialized, array('allowed_classes' => false)); + $this->password) = unserialize($serialized, ['allowed_classes' => false]); } } diff --git a/application/src/Entity/UserInterface.php b/application/src/Entity/UserInterface.php index e5e99dc..61c20e6 100644 --- a/application/src/Entity/UserInterface.php +++ b/application/src/Entity/UserInterface.php @@ -1,14 +1,12 @@ factory = $factory; $this->item = $item; $this->request = $request; } - + /** * @return FactoryInterface */ @@ -40,7 +40,7 @@ class UserMenuEvent extends Event { return $this->factory; } - + /** * @return ItemInterface */ @@ -48,7 +48,7 @@ class UserMenuEvent extends Event { return $this->item; } - + /** * @return RequestStack */ @@ -56,4 +56,4 @@ class UserMenuEvent extends Event { return $this->request; } -} \ No newline at end of file +} diff --git a/application/src/Form/UserType.php b/application/src/Form/UserType.php index efb9dbf..b0abd61 100644 --- a/application/src/Form/UserType.php +++ b/application/src/Form/UserType.php @@ -1,11 +1,11 @@ -add('username', TextType::class) - ->add('plainPassword', RepeatedType::class, array( + ->add('plainPassword', RepeatedType::class, [ 'type' => PasswordType::class, - 'first_options' => array('label' => 'Password'), - 'second_options' => array('label' => 'Repeat Password'), - )) + 'first_options' => ['label' => 'Password'], + 'second_options' => ['label' => 'Repeat Password'], + ]) ; } public function configureOptions(OptionsResolver $resolver) { - $resolver->setDefaults(array( + $resolver->setDefaults([ 'data_class' => User::class, - )); + ]); } -} \ No newline at end of file +} diff --git a/application/src/Menu/Menu.php b/application/src/Menu/Menu.php index 008ba99..e82281b 100644 --- a/application/src/Menu/Menu.php +++ b/application/src/Menu/Menu.php @@ -1,4 +1,5 @@ dispatcher = $dispatcher; $this->factory = $factory; } - + public function userTopbar(RequestStack $request): ItemInterface { - $menu = $this->factory->createItem('root', array( - 'childrenAttributes' => array( - 'class' => 'navbar-nav mr-auto', - ), - )); - + $menu = $this->factory->createItem('root', [ + 'childrenAttributes' => [ + 'class' => 'navbar-nav mr-auto', + ], + ]); + $this->dispatcher->dispatch( UserMenuEvent::EVENT, new UserMenuEvent($this->factory, $menu, $request) ); - + return $menu; - } -} \ No newline at end of file + } +} diff --git a/application/src/Repository/UserRepository.php b/application/src/Repository/UserRepository.php index f575d53..d50e046 100644 --- a/application/src/Repository/UserRepository.php +++ b/application/src/Repository/UserRepository.php @@ -1,14 +1,12 @@ addChild( 'imprint', [ - 'route'=>'imprint', + 'route' => 'imprint', 'attributes' => [ 'icon' => 'fas fa-address-card', ], @@ -95,7 +94,7 @@ class UserMenuSubscriber implements EventSubscriberInterface public static function getSubscribedEvents(): array { return [ - UserMenuEvent::EVENT => 'onUserMenuConfigure' + UserMenuEvent::EVENT => 'onUserMenuConfigure', ]; } } diff --git a/application/tests/unit/Controller/DefaultControllerTest.php b/application/tests/unit/Controller/DefaultControllerTest.php index 67523cd..47af3a1 100644 --- a/application/tests/unit/Controller/DefaultControllerTest.php +++ b/application/tests/unit/Controller/DefaultControllerTest.php @@ -1,15 +1,13 @@ defaultController = new DefaultController(); + + public function setUp(): void + { + $this->defaultController = new DefaultController(); } - - public function testHomepage():void{ + + public function testHomepage(): void + { $client = static::createClient(); $client->request('GET', '/'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } - - public function testImprint():void{ + + public function testImprint(): void + { $client = static::createClient(); $client->request('GET', '/imprint'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } } - diff --git a/application/tests/unit/Controller/UserControllerTest.php b/application/tests/unit/Controller/UserControllerTest.php index e9a29cb..71895c2 100644 --- a/application/tests/unit/Controller/UserControllerTest.php +++ b/application/tests/unit/Controller/UserControllerTest.php @@ -1,4 +1,5 @@ userController = new UserController(); } - + public function testLogout(): void { $client = static::createClient(); $client->request('GET', '/user/logout'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } - + public function testLogin(): void { $client = static::createClient(); $client->request('GET', '/login'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } - - public function testRegister():void + + public function testRegister(): void { $client = static::createClient(); $client->request('GET', '/user/register'); $this->assertEquals(200, $client->getResponse()->getStatusCode()); } } - diff --git a/application/tests/unit/Entity/UserTest.php b/application/tests/unit/Entity/UserTest.php index 167c2e4..7881e16 100644 --- a/application/tests/unit/Entity/UserTest.php +++ b/application/tests/unit/Entity/UserTest.php @@ -1,38 +1,38 @@ user = new User(); $this->user->setPassword(self::PASSWORD); $this->user->setUsername(' '.self::USERNAME.' '); } - - public function testUsername():void{ - $this->assertEquals(self::USERNAME,$this->user->getUsername()); + + public function testUsername(): void + { + $this->assertEquals(self::USERNAME, $this->user->getUsername()); } - - public function testPassword():void{ - $this->assertEquals(self::PASSWORD,$this->user->getPassword()); + + public function testPassword(): void + { + $this->assertEquals(self::PASSWORD, $this->user->getPassword()); } } -