Uploaded image for project: 'eZ Publish / Platform'
  1. eZ Publish / Platform
  2. EZP-29291

[Content Type] redis cache doesn't refresh automatically when creating CT with API in behat tests

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: High High
    • Resolution: Fixed
    • Affects Version/s: 2.2.0, 1.7.7
    • Fix Version/s: 2.5.0-rc2
    • Component/s: QA
    • Labels:

      Description

      When behat tests creates new Content Type through API in method

      EzSystems\RepositoryForms\Features\Context\FieldTypeFormContext::aContentTypeWithAGivenFieldDefinition

      then the redis cache is not refreshing automatically (we need to manually FLUSHALL). The same command executed with console command (php bin/console ez-support-tools:create-ct) works fine and refresh properly.

      <?php
       
      /**
       * File containing the SystemInfoDumpCommand class.
       *
       * @copyright Copyright (C) eZ Systems AS. All rights reserved.
       * @license For full copyright and license information view LICENSE file distributed with this source code.
       */
      namespace EzSystems\EzSupportToolsBundle\Command;
       
      use EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry;
      use EzSystems\EzSupportToolsBundle\SystemInfo\OutputFormatRegistry;
      use Symfony\Bundle\FrameworkBundle\Command\ContainerAwareCommand;
      use Symfony\Component\Console\Input\InputArgument;
      use Symfony\Component\Console\Input\InputOption;
      use Symfony\Component\Console\Input\InputInterface;
      use eZ\Publish\API\Repository\Values\ContentType\FieldDefinitionCreateStruct;
      use Symfony\Component\Console\Output\OutputInterface;
       
      class SystemInfoDumpCommand extends ContainerAwareCommand
      {
          /**
           * System info collector registry.
           *
           * @var \EzSystems\EzSupportToolsBundle\SystemInfo\SystemInfoCollectorRegistry
           */
          private $systemInfoCollectorRegistry;
       
          /**
           * Output format registry.
           *
           * @var \EzSystems\EzSupportToolsBundle\SystemInfo\OutputFormatRegistry
           */
          private $outputFormatRegistry;
       
          public function __construct(SystemInfoCollectorRegistry $systemInfoCollectorRegistry, OutputFormatRegistry $outputFormatRegistry)
          {
              $this->systemInfoCollectorRegistry = $systemInfoCollectorRegistry;
              $this->outputFormatRegistry = $outputFormatRegistry;
       
              parent::__construct();
          }
       
          /**
           * Define command and input options.
           */
          protected function configure()
          {
              $this
                  ->setName('ez-support-tools:create-ct')
                  ;
          }
       
          /**
           * Execute the Command.
           *
           * @param $input InputInterface
           * @param $output OutputInterface
           */
          protected function execute(InputInterface $input, OutputInterface $output)
          {
              $repository = $this->getContainer()->get( 'ezpublish.api.repository');
              $contentTypeService = $repository->getContentTypeService();
       
              $userService = $repository->getUserService();
              $username = 'admin';
              $password = 'publish';
       
              $permissionResolver = $repository->getPermissionResolver();
              $user = $userService->loadUserByCredentials( $username, $password );
              $permissionResolver->setCurrentUserReference($user);
       
              $id = 'content_type_' . uniqid();
              $contentTypeCreateStruct = $contentTypeService->newContentTypeCreateStruct($id);
       
              $fieldDefinition = [
                  'identifier' => 'Field',
                  'fieldTypeIdentifier' => 'ezstring',
                  'names' => ['eng-GB' => 'Field'],
              ];
       
              $contentTypeCreateStruct->addFieldDefinition(new FieldDefinitionCreateStruct($fieldDefinition));
              $contentTypeCreateStruct->mainLanguageCode = 'eng-GB';
              $contentTypeCreateStruct->names = ['eng-GB' => $id];
       
              $contentTypeService->publishContentTypeDraft(
                  $contentTypeService->createContentType(
                      $contentTypeCreateStruct,
                      [$contentTypeService->loadContentTypeGroupByIdentifier('Content')]
                  )
              );
          }
      }

        Issue Links

          Activity

          Hide
          Maciej Tyrała added a comment -

          Till the bug isn't fixed, tests that fail (ezplatform-admin-ui / ContentTypeFields.feature), will be tagged with @EZP-29291-excluded tag, and ignored in travis tests on varnish-redis environment. Please remove this after fixing.

          Show
          Maciej Tyrała added a comment - Till the bug isn't fixed, tests that fail ( ezplatform-admin-ui / ContentTypeFields.feature ), will be tagged with @ EZP-29291 -excluded tag, and ignored in travis tests on varnish-redis environment. Please remove this after fixing.
          Show
          Marek Nocoń added a comment - Same thing happens in repository-forms - since 1.7 version. Example: https://github.com/ezsystems/repository-forms/pull/245/commits/460e95f47ed504672793786aaa17993e43e6b925 https://travis-ci.org/ezsystems/repository-forms/builds/408425047?utm_source=github_status&utm_medium=notification Scenario: https://github.com/ezsystems/repository-forms/blob/master/features/FieldTypeForm/selection_fieldtype_edit_form.feature#L31
          Hide
          Andrzej Longosz added a comment -

          EZP-30318 for solves this issue via ezystems/ezplatform#370.

          TODO

          • Remove EZP-29291-excluded behat tag from dependencies.
          Show
          Andrzej Longosz added a comment - EZP-30318 for solves this issue via ezystems/ezplatform#370 . TODO Remove EZP-29291 -excluded behat tag from dependencies.
          Show
          Maciej Tyrała added a comment - PRs for removing tag: https://github.com/ezsystems/ezplatform-page-builder/pull/318 https://github.com/ezsystems/ezplatform-admin-ui/pull/910
          Show
          Maciej Tyrała added a comment - Merged: https://github.com/ezsystems/ezplatform-page-builder/commit/62b5b0ab28e0a8ecf0cd208d8a7a6fbb6dec9201 https://github.com/ezsystems/ezplatform-admin-ui/commit/2f0000c16282d9ef64b0d9cdc1522466107bb599

            People

            • Assignee:
              Unassigned
              Reporter:
              Maciej Tyrała
            • Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: