From f67fb1dd9a6ea04578f2955a27b28228d374c3cd Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Miko=C5=82aj=20Kr=C3=B3l?= Date: Fri, 2 Feb 2018 18:44:32 +0100 Subject: [PATCH 1/2] Improve coding standards --- src/Entity/Block.php | 6 ++--- src/Entity/BlockImageInterface.php | 6 ++--- src/Entity/BlockInterface.php | 20 ++++++++--------- src/Entity/BlockTranslation.php | 10 ++++----- src/Entity/BlockTranslationInterface.php | 10 ++++----- src/Entity/FrequentlyAskedQuestion.php | 4 ++-- .../FrequentlyAskedQuestionInterface.php | 16 +++++++------- .../FrequentlyAskedQuestionTranslation.php | 4 ++-- ...entlyAskedQuestionTranslationInterface.php | 4 ++-- src/Entity/Page.php | 4 ++-- src/Entity/PageInterface.php | 22 +++++++++---------- src/Entity/PageTranslation.php | 10 ++++----- src/Entity/PageTranslationInterface.php | 18 +++++++-------- src/Entity/ProductsAwareTrait.php | 1 + src/Entity/Section.php | 4 ++-- src/Entity/SectionInterface.php | 8 +++---- src/Entity/SectionTranslation.php | 2 +- src/Entity/SectionTranslationInterface.php | 4 ++-- .../BlockImageUploadListener.php | 2 +- src/Fixture/Factory/BlockFixtureFactory.php | 6 ++--- .../FrequentlyAskedQuestionFixtureFactory.php | 5 ++--- src/Fixture/Factory/PageFixtureFactory.php | 7 +++--- src/Fixture/Factory/SectionFixtureFactory.php | 3 +-- src/Fixture/PageFixture.php | 6 ++--- src/Fixture/SectionFixture.php | 6 ++--- src/Form/Type/PageType.php | 2 +- src/Form/Type/SectionType.php | 2 +- src/Menu/ContentManagementMenuBuilder.php | 8 +++---- src/Repository/BlockRepositoryInterface.php | 2 +- ...uentlyAskedQuestionRepositoryInterface.php | 2 +- src/Repository/PageRepositoryInterface.php | 4 ++-- src/Repository/SectionRepository.php | 2 +- src/Resolver/PageResourceResolver.php | 3 +-- src/Resources/config/grids/admin/section.yml | 1 - src/Twig/Extension/RenderBlockExtension.php | 3 +-- tests/Application/app/autoload.php | 5 +++-- .../Behaviour/ContainsErrorInterface.php | 1 - tests/Behat/Context/Setup/BlockContext.php | 10 ++++----- .../Setup/FrequentlyAskedQuestionContext.php | 10 ++++----- tests/Behat/Context/Setup/PageContext.php | 11 +++++----- tests/Behat/Context/Setup/SectionContext.php | 3 +-- tests/Behat/Context/Ui/Admin/BlockContext.php | 16 ++++++-------- .../Admin/FrequentlyAskedQuestionContext.php | 14 +++++------- tests/Behat/Context/Ui/Admin/PageContext.php | 17 +++++++------- .../Behat/Context/Ui/Admin/SectionContext.php | 11 +++++----- .../Shop/FrequentlyAskedQuestionContext.php | 2 +- tests/Behat/Context/Ui/Shop/PageContext.php | 13 +++++------ tests/Behat/Page/Admin/Block/CreatePage.php | 3 +-- tests/Behat/Page/Admin/Block/UpdatePage.php | 2 +- .../FrequentlyAskedQuestion/CreatePage.php | 3 ++- tests/Behat/Page/Admin/Page/CreatePage.php | 16 +++++++------- .../Page/Admin/Page/CreatePageInterface.php | 1 + tests/Behat/Page/Admin/Section/CreatePage.php | 6 ++--- .../Admin/Section/CreatePageInterface.php | 1 + tests/Behat/Page/Admin/Section/UpdatePage.php | 1 - .../FrequentlyAskedQuestion/IndexPage.php | 2 +- tests/Behat/Page/Shop/HomePage.php | 2 +- tests/Behat/Page/Shop/HomePageInterface.php | 1 - tests/Behat/Service/RandomStringGenerator.php | 3 ++- .../RandomStringGeneratorInterface.php | 1 + 60 files changed, 177 insertions(+), 195 deletions(-) diff --git a/src/Entity/Block.php b/src/Entity/Block.php index cd15509f8..3cf8a196b 100755 --- a/src/Entity/Block.php +++ b/src/Entity/Block.php @@ -34,17 +34,17 @@ public function __construct() } /** - * @var null|int + * @var int|null */ protected $id; /** - * @var null|string + * @var string|null */ protected $code; /** - * @var null|string + * @var string|null */ protected $type; diff --git a/src/Entity/BlockImageInterface.php b/src/Entity/BlockImageInterface.php index b8e11379a..4874fa0d6 100644 --- a/src/Entity/BlockImageInterface.php +++ b/src/Entity/BlockImageInterface.php @@ -1,11 +1,11 @@ getSubject(); - Assert::isInstanceOf($block,BlockInterface::class); + Assert::isInstanceOf($block, BlockInterface::class); if (BlockInterface::IMAGE_BLOCK_TYPE !== $block->getType()) { return; diff --git a/src/Fixture/Factory/BlockFixtureFactory.php b/src/Fixture/Factory/BlockFixtureFactory.php index 22c50c12a..85960872c 100755 --- a/src/Fixture/Factory/BlockFixtureFactory.php +++ b/src/Fixture/Factory/BlockFixtureFactory.php @@ -87,8 +87,7 @@ public function __construct( ProductRepositoryInterface $productRepository, ChannelContextInterface $channelContext, LocaleContextInterface $localeContext - ) - { + ) { $this->blockFactory = $blockFactory; $this->blockTranslationFactory = $blockTranslationFactory; $this->blockRepository = $blockRepository; @@ -113,7 +112,7 @@ public function load(array $data): void } if (null !== $fields['number']) { - for ($i = 0; $i < $fields['number']; $i++) { + for ($i = 0; $i < $fields['number']; ++$i) { $this->createBlock(md5(uniqid()), $fields); } } else { @@ -163,7 +162,6 @@ private function createBlock(string $code, array $blockData): void $this->blockRepository->add($block); } - /** * @param BlockInterface $block * @param int $limit diff --git a/src/Fixture/Factory/FrequentlyAskedQuestionFixtureFactory.php b/src/Fixture/Factory/FrequentlyAskedQuestionFixtureFactory.php index c19bb385c..557224d29 100755 --- a/src/Fixture/Factory/FrequentlyAskedQuestionFixtureFactory.php +++ b/src/Fixture/Factory/FrequentlyAskedQuestionFixtureFactory.php @@ -43,8 +43,7 @@ public function __construct( FactoryInterface $frequentlyAskedQuestionFactory, FactoryInterface $frequentlyAskedQuestionTranslationFactory, FrequentlyAskedQuestionRepositoryInterface $frequentlyAskedQuestionRepository - ) - { + ) { $this->frequentlyAskedQuestionFactory = $frequentlyAskedQuestionFactory; $this->frequentlyAskedQuestionTranslationFactory = $frequentlyAskedQuestionTranslationFactory; $this->frequentlyAskedQuestionRepository = $frequentlyAskedQuestionRepository; @@ -64,7 +63,7 @@ public function load(array $data): void } if (null !== $fields['number']) { - for ($i = 1; $i <= $fields['number']; $i++) { + for ($i = 1; $i <= $fields['number']; ++$i) { $this->createFrequentlyAskedQuestion(md5(uniqid()), $fields, $i); } } else { diff --git a/src/Fixture/Factory/PageFixtureFactory.php b/src/Fixture/Factory/PageFixtureFactory.php index d4e80f38b..dc1be30f4 100755 --- a/src/Fixture/Factory/PageFixtureFactory.php +++ b/src/Fixture/Factory/PageFixtureFactory.php @@ -76,8 +76,7 @@ public function __construct( ProductRepositoryInterface $productRepository, ChannelContextInterface $channelContext, LocaleContextInterface $localeContext - ) - { + ) { $this->pageFactory = $pageFactory; $this->pageTranslationFactory = $pageTranslationFactory; $this->pageRepository = $pageRepository; @@ -101,8 +100,8 @@ public function load(array $data): void } if (null !== $fields['number']) { - for ($i = 0; $i < $fields['number']; $i++) { - $this->createPage(md5(uniqid()), $fields,true); + for ($i = 0; $i < $fields['number']; ++$i) { + $this->createPage(md5(uniqid()), $fields, true); } } else { $this->createPage($code, $fields); diff --git a/src/Fixture/Factory/SectionFixtureFactory.php b/src/Fixture/Factory/SectionFixtureFactory.php index efbff6054..7ba8271cc 100755 --- a/src/Fixture/Factory/SectionFixtureFactory.php +++ b/src/Fixture/Factory/SectionFixtureFactory.php @@ -43,8 +43,7 @@ public function __construct( FactoryInterface $sectionFactory, FactoryInterface $sectionTranslationFactory, SectionRepositoryInterface $sectionRepository - ) - { + ) { $this->sectionFactory = $sectionFactory; $this->sectionTranslationFactory = $sectionTranslationFactory; $this->sectionRepository = $sectionRepository; diff --git a/src/Fixture/PageFixture.php b/src/Fixture/PageFixture.php index 340f94100..d9e9c85ab 100755 --- a/src/Fixture/PageFixture.php +++ b/src/Fixture/PageFixture.php @@ -33,7 +33,7 @@ public function __construct(FixtureFactoryInterface $pageFixtureFactory) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function load(array $options): void { @@ -41,7 +41,7 @@ public function load(array $options): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getName(): string { @@ -49,7 +49,7 @@ public function getName(): string } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void { diff --git a/src/Fixture/SectionFixture.php b/src/Fixture/SectionFixture.php index 0c9576441..224b50015 100755 --- a/src/Fixture/SectionFixture.php +++ b/src/Fixture/SectionFixture.php @@ -33,7 +33,7 @@ public function __construct(FixtureFactoryInterface $sectionFixtureFactory) } /** - * {@inheritDoc} + * {@inheritdoc} */ public function load(array $options): void { @@ -41,7 +41,7 @@ public function load(array $options): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function getName(): string { @@ -49,7 +49,7 @@ public function getName(): string } /** - * {@inheritDoc} + * {@inheritdoc} */ protected function configureOptionsNode(ArrayNodeDefinition $optionsNode): void { diff --git a/src/Form/Type/PageType.php b/src/Form/Type/PageType.php index d9f9db84d..ef52035d0 100755 --- a/src/Form/Type/PageType.php +++ b/src/Form/Type/PageType.php @@ -14,11 +14,11 @@ use BitBag\SyliusCmsPlugin\Form\Type\Translation\PageTranslationType; use Sylius\Bundle\ProductBundle\Form\Type\ProductAutocompleteChoiceType; +use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType; use Symfony\Component\Form\Extension\Core\Type\CheckboxType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; -use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; final class PageType extends AbstractResourceType { diff --git a/src/Form/Type/SectionType.php b/src/Form/Type/SectionType.php index 800f87c7c..60a94523c 100755 --- a/src/Form/Type/SectionType.php +++ b/src/Form/Type/SectionType.php @@ -13,10 +13,10 @@ namespace BitBag\SyliusCmsPlugin\Form\Type; use BitBag\SyliusCmsPlugin\Form\Type\Translation\SectionTranslationType; +use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; use Sylius\Bundle\ResourceBundle\Form\Type\ResourceTranslationsType; use Symfony\Component\Form\Extension\Core\Type\TextType; use Symfony\Component\Form\FormBuilderInterface; -use Sylius\Bundle\ResourceBundle\Form\Type\AbstractResourceType; final class SectionType extends AbstractResourceType { diff --git a/src/Menu/ContentManagementMenuBuilder.php b/src/Menu/ContentManagementMenuBuilder.php index 71951e82b..1e3635fbb 100755 --- a/src/Menu/ContentManagementMenuBuilder.php +++ b/src/Menu/ContentManagementMenuBuilder.php @@ -30,7 +30,7 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void $cmsRootMenuItem ->addChild('blocks', [ - 'route' => 'bitbag_sylius_cms_plugin_admin_block_index' + 'route' => 'bitbag_sylius_cms_plugin_admin_block_index', ]) ->setLabel('bitbag_sylius_cms_plugin.ui.blocks') ->setLabelAttribute('icon', 'block layout') @@ -38,7 +38,7 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void $cmsRootMenuItem ->addChild('pages', [ - 'route' => 'bitbag_sylius_cms_plugin_admin_page_index' + 'route' => 'bitbag_sylius_cms_plugin_admin_page_index', ]) ->setLabel('bitbag_sylius_cms_plugin.ui.pages') ->setLabelAttribute('icon', 'sticky note') @@ -46,7 +46,7 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void $cmsRootMenuItem ->addChild('faq', [ - 'route' => 'bitbag_sylius_cms_plugin_admin_frequently_asked_question_index' + 'route' => 'bitbag_sylius_cms_plugin_admin_frequently_asked_question_index', ]) ->setLabel('bitbag_sylius_cms_plugin.ui.faq') ->setLabelAttribute('icon', 'help') @@ -54,7 +54,7 @@ public function buildMenu(MenuBuilderEvent $menuBuilderEvent): void $cmsRootMenuItem ->addChild('sections', [ - 'route' => 'bitbag_sylius_cms_plugin_admin_section_index' + 'route' => 'bitbag_sylius_cms_plugin_admin_section_index', ]) ->setLabel('bitbag_sylius_cms_plugin.ui.sections') ->setLabelAttribute('icon', 'grid layout') diff --git a/src/Repository/BlockRepositoryInterface.php b/src/Repository/BlockRepositoryInterface.php index bdc0daffb..1f1a882d8 100755 --- a/src/Repository/BlockRepositoryInterface.php +++ b/src/Repository/BlockRepositoryInterface.php @@ -28,7 +28,7 @@ public function createListQueryBuilder(string $localeCode): QueryBuilder; /** * @param string $code * - * @return null|BlockInterface + * @return BlockInterface|null */ public function findOneEnabledByCode(string $code): ?BlockInterface; diff --git a/src/Repository/FrequentlyAskedQuestionRepositoryInterface.php b/src/Repository/FrequentlyAskedQuestionRepositoryInterface.php index 231dde682..79864d69c 100755 --- a/src/Repository/FrequentlyAskedQuestionRepositoryInterface.php +++ b/src/Repository/FrequentlyAskedQuestionRepositoryInterface.php @@ -35,7 +35,7 @@ public function findEnabledOrderedByPosition(string $localeCode): array; /** * @param string $code * - * @return null|FrequentlyAskedQuestionInterface + * @return FrequentlyAskedQuestionInterface|null */ public function findOneEnabledByCode(string $code): ?FrequentlyAskedQuestionInterface; } diff --git a/src/Repository/PageRepositoryInterface.php b/src/Repository/PageRepositoryInterface.php index 4e219cf69..8943ffbae 100755 --- a/src/Repository/PageRepositoryInterface.php +++ b/src/Repository/PageRepositoryInterface.php @@ -27,7 +27,7 @@ public function createListQueryBuilder(string $locale): QueryBuilder; /** * @param string $code - * @param null|string $localeCode + * @param string|null $localeCode * * @return PageInterface|null */ @@ -37,7 +37,7 @@ public function findOneEnabledByCode(string $code, ?string $localeCode): ?PageIn * @param string $slug * @param string $localeCode * - * @return null|PageInterface + * @return PageInterface|null */ public function findOneEnabledBySlug(string $slug, ?string $localeCode): ?PageInterface; diff --git a/src/Repository/SectionRepository.php b/src/Repository/SectionRepository.php index 54f9440c4..d421ae29f 100755 --- a/src/Repository/SectionRepository.php +++ b/src/Repository/SectionRepository.php @@ -35,7 +35,7 @@ public function findByNamePart(string $phrase, ?string $locale = null): array return $this->createQueryBuilder('o') ->innerJoin('o.translations', 'translation', 'WITH', 'translation.locale = :locale') ->andWhere('translation.name LIKE :name') - ->setParameter('name', '%'.$phrase.'%') + ->setParameter('name', '%' . $phrase . '%') ->setParameter('locale', $locale) ->getQuery() ->getResult() diff --git a/src/Resolver/PageResourceResolver.php b/src/Resolver/PageResourceResolver.php index 1dd13b6b4..8cc2d5195 100755 --- a/src/Resolver/PageResourceResolver.php +++ b/src/Resolver/PageResourceResolver.php @@ -43,8 +43,7 @@ public function __construct( PageRepositoryInterface $pageRepository, LocaleContextInterface $localeContext, LoggerInterface $logger - ) - { + ) { $this->pageRepository = $pageRepository; $this->localeContext = $localeContext; $this->logger = $logger; diff --git a/src/Resources/config/grids/admin/section.yml b/src/Resources/config/grids/admin/section.yml index e79f0a2ac..d169953ff 100755 --- a/src/Resources/config/grids/admin/section.yml +++ b/src/Resources/config/grids/admin/section.yml @@ -7,7 +7,6 @@ sylius_grid: class: "%bitbag_sylius_cms_plugin.model.section.class%" repository: method: createListQueryBuilder - arguments: ["%locale%"] sorting: code: asc limits: [10, 25, 50] diff --git a/src/Twig/Extension/RenderBlockExtension.php b/src/Twig/Extension/RenderBlockExtension.php index c017fdd9c..f3d062135 100755 --- a/src/Twig/Extension/RenderBlockExtension.php +++ b/src/Twig/Extension/RenderBlockExtension.php @@ -43,8 +43,7 @@ public function __construct( BlockRepositoryInterface $blockRepository, BlockTemplateResolverInterface $blockTemplateResolver, BlockResourceResolverInterface $blockResourceResolver - ) - { + ) { $this->blockRepository = $blockRepository; $this->blockTemplateResolver = $blockTemplateResolver; $this->blockResourceResolver = $blockResourceResolver; diff --git a/tests/Application/app/autoload.php b/tests/Application/app/autoload.php index d27ccfd05..accc566e3 100644 --- a/tests/Application/app/autoload.php +++ b/tests/Application/app/autoload.php @@ -1,10 +1,11 @@ sharedStorage = $sharedStorage; $this->randomStringGenerator = $randomStringGenerator; $this->blockFactory = $blockFactory; @@ -136,8 +135,8 @@ public function thereIsAnExistingBlockWithCodeAndImage(string $code, string $ima /** * @param string $type - * @param null|string $code - * @param null|string $content + * @param string|null $code + * @param string|null $content * @param string|null $image * * @return BlockInterface @@ -147,8 +146,7 @@ private function createBlock( ?string $code = null, ?string $content = null, string $image = null - ): BlockInterface - { + ): BlockInterface { $block = $this->blockFactory->createWithType($type); $block->setCurrentLocale('en_US'); diff --git a/tests/Behat/Context/Setup/FrequentlyAskedQuestionContext.php b/tests/Behat/Context/Setup/FrequentlyAskedQuestionContext.php index 056970b09..16e46224b 100755 --- a/tests/Behat/Context/Setup/FrequentlyAskedQuestionContext.php +++ b/tests/Behat/Context/Setup/FrequentlyAskedQuestionContext.php @@ -47,8 +47,7 @@ public function __construct( RandomStringGeneratorInterface $randomStringGenerator, FactoryInterface $frequentlyAskedQuestionFactory, FrequentlyAskedQuestionRepositoryInterface $frequentlyAskedQuestionRepository - ) - { + ) { $this->sharedStorage = $sharedStorage; $this->randomStringGenerator = $randomStringGenerator; $this->frequentlyAskedQuestionFactory = $frequentlyAskedQuestionFactory; @@ -95,7 +94,7 @@ public function thereIsAnExistingFrequentlyAskedQuestionWithCode(string $code): */ public function thereAreFaqsInTheStore(int $number): void { - for ($i = 1; $i <= $number; $i++) { + for ($i = 1; $i <= $number; ++$i) { $frequentlyAskedQuestion = $this->createFrequentlyAskedQuestion(null, $i, true); $this->saveFrequentlyAskedQuestion($frequentlyAskedQuestion); @@ -103,7 +102,7 @@ public function thereAreFaqsInTheStore(int $number): void } /** - * @param null|string $code + * @param string|null $code * @param int|null $position * @param bool $prefixQuestionWithPosition * @@ -113,8 +112,7 @@ private function createFrequentlyAskedQuestion( ?string $code = null, int $position = null, bool $prefixQuestionWithPosition = false - ): FrequentlyAskedQuestionInterface - { + ): FrequentlyAskedQuestionInterface { /** @var FrequentlyAskedQuestionInterface $frequentlyAskedQuestion */ $frequentlyAskedQuestion = $this->frequentlyAskedQuestionFactory->createNew(); diff --git a/tests/Behat/Context/Setup/PageContext.php b/tests/Behat/Context/Setup/PageContext.php index d66479119..9677a8191 100755 --- a/tests/Behat/Context/Setup/PageContext.php +++ b/tests/Behat/Context/Setup/PageContext.php @@ -77,8 +77,7 @@ public function __construct( EntityManagerInterface $entityManager, ProductRepositoryInterface $productRepository, SectionRepositoryInterface $sectionRepository - ) - { + ) { $this->sharedStorage = $sharedStorage; $this->randomStringGenerator = $randomStringGenerator; $this->pageFactory = $pageFactory; @@ -113,7 +112,7 @@ public function thereIsAPageWithName(string $name): void */ public function thereArePagesInTheStore(int $number): void { - for ($i = 0; $i < $number; $i++) { + for ($i = 0; $i < $number; ++$i) { $page = $this->createPage(); $this->savePage($page); @@ -215,9 +214,9 @@ public function thesePagesHaveThisSectionAssociatedWithIt(): void } /** - * @param null|string $code - * @param null|string $name - * @param null|string $content + * @param string|null $code + * @param string|null $name + * @param string|null $content * * @return PageInterface */ diff --git a/tests/Behat/Context/Setup/SectionContext.php b/tests/Behat/Context/Setup/SectionContext.php index ee5af3d81..eb62b539e 100755 --- a/tests/Behat/Context/Setup/SectionContext.php +++ b/tests/Behat/Context/Setup/SectionContext.php @@ -48,8 +48,7 @@ public function __construct( RandomStringGeneratorInterface $randomStringGenerator, FactoryInterface $sectionFactory, SectionRepositoryInterface $sectionRepository - ) - { + ) { $this->sharedStorage = $sharedStorage; $this->randomStringGenerator = $randomStringGenerator; $this->sectionFactory = $sectionFactory; diff --git a/tests/Behat/Context/Ui/Admin/BlockContext.php b/tests/Behat/Context/Ui/Admin/BlockContext.php index f8fc6ec7c..8d33dd515 100755 --- a/tests/Behat/Context/Ui/Admin/BlockContext.php +++ b/tests/Behat/Context/Ui/Admin/BlockContext.php @@ -88,8 +88,7 @@ public function __construct( UpdatePageInterface $updatePage, RandomStringGeneratorInterface $randomStringGenerator, BlockRepositoryInterface $blockRepository - ) - { + ) { $this->sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; $this->notificationChecker = $notificationChecker; @@ -113,7 +112,6 @@ public function iGoToTheBlocksPage() */ public function iGoToTheCreateImageBlockPage(string $blockType): void { - if (BlockInterface::TEXT_BLOCK_TYPE === $blockType) { $this->createPage->open(['type' => BlockInterface::TEXT_BLOCK_TYPE]); @@ -268,7 +266,7 @@ public function iUpdateIt(): void public function iShouldBeNotifiedThatNewImageBlockHasBeenCreated(): void { $this->notificationChecker->checkNotification( - "Block has been successfully created.", + 'Block has been successfully created.', NotificationType::success() ); } @@ -279,7 +277,7 @@ public function iShouldBeNotifiedThatNewImageBlockHasBeenCreated(): void public function iShouldBeNotifiedThatTheBlockHasBeenSuccessfullyUpdated(): void { $this->notificationChecker->checkNotification( - "Block has been successfully updated.", + 'Block has been successfully updated.', NotificationType::success() ); } @@ -290,7 +288,7 @@ public function iShouldBeNotifiedThatTheBlockHasBeenSuccessfullyUpdated(): void public function iShouldBeNotifiedThatTheBlockHasBeenDeleted(): void { $this->notificationChecker->checkNotification( - "Block has been successfully deleted.", + 'Block has been successfully deleted.', NotificationType::success() ); } @@ -312,7 +310,7 @@ public function iShouldBeNotifiedThatCannotBeBlank(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s cannot be blank.", + '%s cannot be blank.', trim($field) ))); } @@ -324,7 +322,7 @@ public function iShouldBeNotifiedThatCannotBeBlank(string $fields): void public function iShouldBeNotifiedThatThereIsAlreadyAnExistingBlockWithCode(): void { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage( - "There is an existing block with this code.", + 'There is an existing block with this code.', false )); } @@ -338,7 +336,7 @@ public function iShouldBeNotifiedThatFieldsAreTooLong(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s can not be longer than", + '%s can not be longer than', trim($field) ), false)); } diff --git a/tests/Behat/Context/Ui/Admin/FrequentlyAskedQuestionContext.php b/tests/Behat/Context/Ui/Admin/FrequentlyAskedQuestionContext.php index 4b224f656..a34e0ab73 100755 --- a/tests/Behat/Context/Ui/Admin/FrequentlyAskedQuestionContext.php +++ b/tests/Behat/Context/Ui/Admin/FrequentlyAskedQuestionContext.php @@ -78,9 +78,7 @@ public function __construct( CreatePageInterface $createPage, UpdatePageInterface $updatePage, RandomStringGeneratorInterface $randomStringGenerator - ) - { - + ) { $this->sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; $this->notificationChecker = $notificationChecker; @@ -196,7 +194,7 @@ public function iShouldBeNotifiedThatANewFrequentlyAskedQuestionHasBeenCreated() public function iShouldBeNotifiedThatTheFrequentlyAskedQuestionHasBeenDeleted(): void { $this->notificationChecker->checkNotification( - "Frequently asked question has been successfully deleted.", + 'Frequently asked question has been successfully deleted.', NotificationType::success() ); } @@ -210,7 +208,7 @@ public function iShouldBeNotifiedThatFieldsCannotBeBlank(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s cannot be blank.", + '%s cannot be blank.', trim($field) ))); } @@ -225,7 +223,7 @@ public function iShouldBeNotifiedThatFieldsAreTooShort(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s must be at least %d characters long.", + '%s must be at least %d characters long.', trim($field), 2 ))); } @@ -237,7 +235,7 @@ public function iShouldBeNotifiedThatFieldsAreTooShort(string $fields): void public function iShouldBeNotifiedThatThereIsAlreadyAnExistingFrequentlyAskedQuestionWithProvidedCode(): void { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage( - "There is an existing FAQ with this code.", + 'There is an existing FAQ with this code.', false )); } @@ -248,7 +246,7 @@ public function iShouldBeNotifiedThatThereIsAlreadyAnExistingFrequentlyAskedQues public function iShouldBeNotifiedThatThereIsAlreadyAnExistingFrequentlyAskedQuestionWithSelectedPosition(): void { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage( - "There is an existing FAQ with this position.", + 'There is an existing FAQ with this position.', false )); } diff --git a/tests/Behat/Context/Ui/Admin/PageContext.php b/tests/Behat/Context/Ui/Admin/PageContext.php index cdc94c0e1..61643102e 100755 --- a/tests/Behat/Context/Ui/Admin/PageContext.php +++ b/tests/Behat/Context/Ui/Admin/PageContext.php @@ -86,8 +86,7 @@ public function __construct( UpdatePageInterface $updatePage, RandomStringGeneratorInterface $randomStringGenerator, PageRepositoryInterface $pageRepository - ) - { + ) { $this->sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; $this->notificationChecker = $notificationChecker; @@ -253,7 +252,7 @@ public function iUpdateIt(): void public function iShouldBeNotifiedThatNewPageWasCreated(): void { $this->notificationChecker->checkNotification( - "Page has been successfully created.", + 'Page has been successfully created.', NotificationType::success() ); } @@ -264,7 +263,7 @@ public function iShouldBeNotifiedThatNewPageWasCreated(): void public function iShouldBeNotifiedThatThePageWasUpdated(): void { $this->notificationChecker->checkNotification( - "Page has been successfully updated.", + 'Page has been successfully updated.', NotificationType::success() ); } @@ -275,7 +274,7 @@ public function iShouldBeNotifiedThatThePageWasUpdated(): void public function iShouldBeNotifiedThatThePageHasBeenDeleted(): void { $this->notificationChecker->checkNotification( - "Page has been successfully deleted.", + 'Page has been successfully deleted.', NotificationType::success() ); } @@ -286,7 +285,7 @@ public function iShouldBeNotifiedThatThePageHasBeenDeleted(): void public function iShouldBeNotifiedThatThereIsAlreadyAnExistingPageWithCode(): void { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage( - "There is an existing page with this code.", + 'There is an existing page with this code.', false )); } @@ -300,7 +299,7 @@ public function iShouldBeNotifiedThatFieldsCannotBeBlank(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s cannot be blank.", + '%s cannot be blank.', trim($field) ))); } @@ -315,7 +314,7 @@ public function iShouldBeNotifiedThatFieldsAreTooShort(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s must be at least %d characters long.", + '%s must be at least %d characters long.', trim($field), 2 ))); } @@ -330,7 +329,7 @@ public function iShouldBeNotifiedThatFieldsAreTooLong(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s can not be longer than", + '%s can not be longer than', trim($field) ), false)); } diff --git a/tests/Behat/Context/Ui/Admin/SectionContext.php b/tests/Behat/Context/Ui/Admin/SectionContext.php index 626ce5a9e..a2268b7dc 100755 --- a/tests/Behat/Context/Ui/Admin/SectionContext.php +++ b/tests/Behat/Context/Ui/Admin/SectionContext.php @@ -78,8 +78,7 @@ public function __construct( CreatePageInterface $createPage, UpdatePageInterface $updatePage, RandomStringGeneratorInterface $randomStringGenerator - ) - { + ) { $this->sharedStorage = $sharedStorage; $this->currentPageResolver = $currentPageResolver; $this->notificationChecker = $notificationChecker; @@ -171,7 +170,7 @@ public function iShouldBeNotifiedThatFieldsCannotBeBlank(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s cannot be blank.", + '%s cannot be blank.', trim($field) ))); } @@ -186,7 +185,7 @@ public function iShouldBeNotifiedThatFieldsAreTooShort(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s must be at least %d characters long.", + '%s must be at least %d characters long.', trim($field), 2 ))); } @@ -201,7 +200,7 @@ public function iShouldBeNotifiedThatFieldsAreTooLong(string $fields): void foreach ($fields as $field) { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage(sprintf( - "%s can not be longer than", + '%s can not be longer than', trim($field) ), false)); } @@ -213,7 +212,7 @@ public function iShouldBeNotifiedThatFieldsAreTooLong(string $fields): void public function iShouldBeNotifiedThatThereIsAlreadyAnExistingSectionWithCode(): void { Assert::true($this->resolveCurrentPage()->containsErrorWithMessage( - "There is an existing section with this code.", + 'There is an existing section with this code.', false )); } diff --git a/tests/Behat/Context/Ui/Shop/FrequentlyAskedQuestionContext.php b/tests/Behat/Context/Ui/Shop/FrequentlyAskedQuestionContext.php index 66363c9e5..b62bc8b31 100755 --- a/tests/Behat/Context/Ui/Shop/FrequentlyAskedQuestionContext.php +++ b/tests/Behat/Context/Ui/Shop/FrequentlyAskedQuestionContext.php @@ -46,7 +46,7 @@ public function iShouldSeeFaqsOrderedByPosition(int $number): void { Assert::true($this->indexPage->hasFrequentlyAskedQuestionsNumber($number)); - for ($i = 1; $i < $number; $i++) { + for ($i = 1; $i < $number; ++$i) { Assert::true($this->indexPage->hasQuestionWithPositionPrefixAtValidIndex($i)); } } diff --git a/tests/Behat/Context/Ui/Shop/PageContext.php b/tests/Behat/Context/Ui/Shop/PageContext.php index 85d5e2b67..2bedcf5b0 100755 --- a/tests/Behat/Context/Ui/Shop/PageContext.php +++ b/tests/Behat/Context/Ui/Shop/PageContext.php @@ -14,8 +14,8 @@ use Behat\Behat\Context\Context; use Sylius\Behat\Service\SharedStorageInterface; -use Tests\BitBag\SyliusCmsPlugin\Behat\Page\Shop\Page\ShowPageInterface; use Tests\BitBag\SyliusCmsPlugin\Behat\Page\Shop\Page\IndexPageInterface; +use Tests\BitBag\SyliusCmsPlugin\Behat\Page\Shop\Page\ShowPageInterface; use Webmozart\Assert\Assert; final class PageContext implements Context @@ -41,11 +41,10 @@ final class PageContext implements Context * @param SharedStorageInterface $sharedStorage */ public function __construct( - ShowPageInterface $showPage, + ShowPageInterface $showPage, IndexPageInterface $indexPage, SharedStorageInterface $sharedStorage - ) - { + ) { $this->showPage = $showPage; $this->indexPage = $indexPage; $this->sharedStorage = $sharedStorage; @@ -58,17 +57,17 @@ public function iGoToThePage(string $slug): void { $this->showPage->open(['slug' => $slug]); } - + /** * @When I go to this page */ public function iGoToThisPage(): void { $slug = $this->sharedStorage->get('page')->getSlug(); - + $this->showPage->open(['slug' => $slug]); } - + /** * @When I go to the section pages list for the :sectionCode section */ diff --git a/tests/Behat/Page/Admin/Block/CreatePage.php b/tests/Behat/Page/Admin/Block/CreatePage.php index d543f57bf..754468e4c 100755 --- a/tests/Behat/Page/Admin/Block/CreatePage.php +++ b/tests/Behat/Page/Admin/Block/CreatePage.php @@ -22,7 +22,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface use ContainsErrorTrait; /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillField(string $field, string $value): void { @@ -48,7 +48,6 @@ public function uploadImage(string $image): void $this->getDocument() ->attachFileToField('Choose file', $path); - ; } /** diff --git a/tests/Behat/Page/Admin/Block/UpdatePage.php b/tests/Behat/Page/Admin/Block/UpdatePage.php index 877949cdb..bb6f8d55e 100755 --- a/tests/Behat/Page/Admin/Block/UpdatePage.php +++ b/tests/Behat/Page/Admin/Block/UpdatePage.php @@ -21,7 +21,7 @@ class UpdatePage extends BaseUpdatePage implements UpdatePageInterface use ChecksCodeImmutabilityTrait; /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillField(string $field, string $value): void { diff --git a/tests/Behat/Page/Admin/FrequentlyAskedQuestion/CreatePage.php b/tests/Behat/Page/Admin/FrequentlyAskedQuestion/CreatePage.php index f3afc73df..746718557 100755 --- a/tests/Behat/Page/Admin/FrequentlyAskedQuestion/CreatePage.php +++ b/tests/Behat/Page/Admin/FrequentlyAskedQuestion/CreatePage.php @@ -20,7 +20,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface use ContainsErrorTrait; /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillField(string $field, string $value): void { @@ -34,6 +34,7 @@ public function fillCode(string $code): void { $this->getDocument()->fillField('Code', $code); } + /** * {@inheritdoc} */ diff --git a/tests/Behat/Page/Admin/Page/CreatePage.php b/tests/Behat/Page/Admin/Page/CreatePage.php index 577904359..0ebd5ee77 100755 --- a/tests/Behat/Page/Admin/Page/CreatePage.php +++ b/tests/Behat/Page/Admin/Page/CreatePage.php @@ -23,7 +23,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface use ContainsErrorTrait; /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillField(string $field, string $value): void { @@ -31,7 +31,7 @@ public function fillField(string $field, string $value): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillCode(string $code): void { @@ -39,7 +39,7 @@ public function fillCode(string $code): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillName(string $name): void { @@ -51,7 +51,7 @@ public function fillName(string $name): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillSlug(string $slug): void { @@ -59,7 +59,7 @@ public function fillSlug(string $slug): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillMetaKeywords(string $metaKeywords): void { @@ -67,7 +67,7 @@ public function fillMetaKeywords(string $metaKeywords): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillMetaDescription(string $metaDescription): void { @@ -75,7 +75,7 @@ public function fillMetaDescription(string $metaDescription): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillContent(string $content): void { @@ -83,7 +83,7 @@ public function fillContent(string $content): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function associateSections(array $sectionsNames): void { diff --git a/tests/Behat/Page/Admin/Page/CreatePageInterface.php b/tests/Behat/Page/Admin/Page/CreatePageInterface.php index b12a30d9a..dc704ad69 100755 --- a/tests/Behat/Page/Admin/Page/CreatePageInterface.php +++ b/tests/Behat/Page/Admin/Page/CreatePageInterface.php @@ -47,6 +47,7 @@ public function fillMetaKeywords(string $metaKeywords): void; * @param string $metaDescription */ public function fillMetaDescription(string $metaDescription): void; + /** * @param string $content */ diff --git a/tests/Behat/Page/Admin/Section/CreatePage.php b/tests/Behat/Page/Admin/Section/CreatePage.php index 816a74927..b17a14dab 100755 --- a/tests/Behat/Page/Admin/Section/CreatePage.php +++ b/tests/Behat/Page/Admin/Section/CreatePage.php @@ -20,7 +20,7 @@ class CreatePage extends BaseCreatePage implements CreatePageInterface use ContainsErrorTrait; /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillField(string $field, string $value): void { @@ -28,7 +28,7 @@ public function fillField(string $field, string $value): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillCode(string $code): void { @@ -36,7 +36,7 @@ public function fillCode(string $code): void } /** - * {@inheritDoc} + * {@inheritdoc} */ public function fillName(string $name): void { diff --git a/tests/Behat/Page/Admin/Section/CreatePageInterface.php b/tests/Behat/Page/Admin/Section/CreatePageInterface.php index de5fb7657..e1e02ab01 100755 --- a/tests/Behat/Page/Admin/Section/CreatePageInterface.php +++ b/tests/Behat/Page/Admin/Section/CreatePageInterface.php @@ -27,6 +27,7 @@ public function fillField(string $field, string $value): void; * @param string $code */ public function fillCode(string $code): void; + /** * @param string $name */ diff --git a/tests/Behat/Page/Admin/Section/UpdatePage.php b/tests/Behat/Page/Admin/Section/UpdatePage.php index 60fc7eaf4..eca4c329c 100755 --- a/tests/Behat/Page/Admin/Section/UpdatePage.php +++ b/tests/Behat/Page/Admin/Section/UpdatePage.php @@ -14,7 +14,6 @@ use Sylius\Behat\Page\Admin\Crud\UpdatePage as BaseUpdatePage; use Tests\BitBag\SyliusCmsPlugin\Behat\Behaviour\ChecksCodeImmutabilityTrait; -use Tests\BitBag\SyliusCmsPlugin\Behat\Behaviour\ContainsErrorTrait; class UpdatePage extends BaseUpdatePage implements UpdatePageInterface { diff --git a/tests/Behat/Page/Shop/FrequentlyAskedQuestion/IndexPage.php b/tests/Behat/Page/Shop/FrequentlyAskedQuestion/IndexPage.php index 1d2b2d9df..eb0b10bc6 100755 --- a/tests/Behat/Page/Shop/FrequentlyAskedQuestion/IndexPage.php +++ b/tests/Behat/Page/Shop/FrequentlyAskedQuestion/IndexPage.php @@ -50,7 +50,7 @@ public function hasQuestionWithPositionPrefixAtValidIndex(int $position): bool $question = $frequentlyAskedQuestionOnPage->getText(); $questionParts = explode('. ', $question); - $positionInQuestion = (int)str_replace('. ', '', $questionParts[0]); + $positionInQuestion = (int) str_replace('. ', '', $questionParts[0]); if ($position === $positionInQuestion) { return true; diff --git a/tests/Behat/Page/Shop/HomePage.php b/tests/Behat/Page/Shop/HomePage.php index 36873cdb1..c96704d9b 100755 --- a/tests/Behat/Page/Shop/HomePage.php +++ b/tests/Behat/Page/Shop/HomePage.php @@ -21,7 +21,7 @@ class HomePage extends BaseHomePage implements HomePageInterface */ public function hasImageBlock(): bool { - return $this->getElement('image_block')->has('css','img'); + return $this->getElement('image_block')->has('css', 'img'); } /** diff --git a/tests/Behat/Page/Shop/HomePageInterface.php b/tests/Behat/Page/Shop/HomePageInterface.php index 86deea9b1..530cbacfa 100755 --- a/tests/Behat/Page/Shop/HomePageInterface.php +++ b/tests/Behat/Page/Shop/HomePageInterface.php @@ -10,7 +10,6 @@ declare(strict_types=1); - namespace Tests\BitBag\SyliusCmsPlugin\Behat\Page\Shop; use Sylius\Behat\Page\Shop\HomePageInterface as BaseHomePageInterface; diff --git a/tests/Behat/Service/RandomStringGenerator.php b/tests/Behat/Service/RandomStringGenerator.php index 5116e8f59..a11435963 100755 --- a/tests/Behat/Service/RandomStringGenerator.php +++ b/tests/Behat/Service/RandomStringGenerator.php @@ -1,5 +1,6 @@ Date: Fri, 2 Feb 2018 19:00:37 +0100 Subject: [PATCH 2/2] Upgrade jQuery --- tests/Application/yarn.lock | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Application/yarn.lock b/tests/Application/yarn.lock index ce841be62..7857a1251 100644 --- a/tests/Application/yarn.lock +++ b/tests/Application/yarn.lock @@ -928,7 +928,7 @@ gulp-util@^3.0, gulp-util@^3.0.0, gulp-util@^3.0.2, gulp-util@^3.0.7, gulp-util@ through2 "^2.0.0" vinyl "^0.5.0" -gulp@^3.9.1: +gulp@^3.9.0: version "3.9.1" resolved "https://registry.yarnpkg.com/gulp/-/gulp-3.9.1.tgz#571ce45928dd40af6514fc4011866016c13845b4" dependencies: @@ -1203,7 +1203,7 @@ jodid25519@^1.0.0: dependencies: jsbn "~0.1.0" -jquery@^2.2.4, jquery@x.*: +jquery@^2.2.0, jquery@x.*: version "2.2.4" resolved "https://registry.yarnpkg.com/jquery/-/jquery-2.2.4.tgz#2c89d6889b5eac522a7eea32c14521559c6cbf02" @@ -2057,9 +2057,9 @@ scss-tokenizer@^0.2.1: js-base64 "^2.1.8" source-map "^0.4.2" -semantic-ui-css@^2.2.12: - version "2.2.12" - resolved "https://registry.yarnpkg.com/semantic-ui-css/-/semantic-ui-css-2.2.12.tgz#afc462e5bb4f8a0dcfe3dca11274499a997490dd" +semantic-ui-css@^2.2.0: + version "2.2.14" + resolved "https://registry.yarnpkg.com/semantic-ui-css/-/semantic-ui-css-2.2.14.tgz#1888c386c74e5c0abfa00508a94940e93a55465b" dependencies: jquery x.*