Skip to content
Snippets Groups Projects
Verified Commit dd7ff90b authored by Dave Long's avatar Dave Long
Browse files

Issue #3496259 by spokje: [random test failure] LayoutSectionTest::testLayoutSectionFormatterAccess

(cherry picked from commit 2396ee2b)
parent 5a89db6f
No related branches found
No related tags found
21 merge requests!12227Issue #3181946 by jonmcl, mglaman,!12079Issue #3523476 by matthiasm11: Add empty check on operator,!12024Fix: DocBlock comment for return value of Drupal\Core\Database\Connection::transactionManager(),!11974Draft: Issue #3495165 by catch, joeyroth, berdir, texas-bronius: Better warning...,!11934Issue #3520997: DefaultLazyPluginCollection unnecessarily instantiates plugins when sorting collection,!11887Issue #3520065: The migrate Row class API is incomplete,!11636Draft: Issue #3515643 by macsim: fieldNameExists method is inconsistent,!11515Issue #3480419 by mondrake, smustgrave, catch: Method...,!11380Issue #3490698 by catch, spokje: Bump MINIMUM_STABILITY back to 'stable' when...,!11281Use Drupal Core Leadership terminology in MAINTAINERS.txt,!11239Issue #3507548: Allow workspace changes listing to show all items, without a pager,!11238Fix issue #3051797,!11213Issue #3506743 by tomislav.matokovic: Increasing the color contrast for the navigation block title against the background of the navigation sidebar to at least 4.5:1,!11147Draft: Try to avoid manually setting required cache contexts,!11108Issue #3490298 by nicxvan: Profiles can be missed in OOP hooks,!11093Drupal on MongoDB 11.1.x,!11017Issue #3502540: Add date filter for moderated content.,!11009Issue #3486972 migrate feed icon,!10999Cleaning up Taxonomy hooks and updating baseline.,!10977Issue #3501457: Fix path used in a A11y Test Admin,!10881Issue #3489329 by mfb, casey: symfony/http-foundation commit 32310ff breaks PathValidator
Pipeline #384966 passed
Pipeline: drupal

#384968

    ...@@ -8,9 +8,9 @@ ...@@ -8,9 +8,9 @@
    use Drupal\Core\Block\Attribute\Block; use Drupal\Core\Block\Attribute\Block;
    use Drupal\Core\Block\BlockBase; use Drupal\Core\Block\BlockBase;
    use Drupal\Core\Cache\Cache; use Drupal\Core\Cache\Cache;
    use Drupal\Core\KeyValueStore\KeyValueStoreInterface;
    use Drupal\Core\Plugin\ContainerFactoryPluginInterface; use Drupal\Core\Plugin\ContainerFactoryPluginInterface;
    use Drupal\Core\Session\AccountInterface; use Drupal\Core\Session\AccountInterface;
    use Drupal\Core\State\StateInterface;
    use Drupal\Core\StringTranslation\TranslatableMarkup; use Drupal\Core\StringTranslation\TranslatableMarkup;
    use Symfony\Component\DependencyInjection\ContainerInterface; use Symfony\Component\DependencyInjection\ContainerInterface;
    ...@@ -23,11 +23,6 @@ ...@@ -23,11 +23,6 @@
    )] )]
    class TestAccessBlock extends BlockBase implements ContainerFactoryPluginInterface { class TestAccessBlock extends BlockBase implements ContainerFactoryPluginInterface {
    /**
    * The state service.
    */
    protected StateInterface $state;
    /** /**
    * Tests the test access block. * Tests the test access block.
    * *
    ...@@ -41,13 +36,11 @@ class TestAccessBlock extends BlockBase implements ContainerFactoryPluginInterfa ...@@ -41,13 +36,11 @@ class TestAccessBlock extends BlockBase implements ContainerFactoryPluginInterfa
    * The plugin ID for the plugin instance. * The plugin ID for the plugin instance.
    * @param mixed $plugin_definition * @param mixed $plugin_definition
    * The plugin implementation definition. * The plugin implementation definition.
    * @param \Drupal\Core\State\StateInterface $state * @param \Drupal\Core\KeyValueStore\KeyValueStoreInterface $keyValue
    * The state. * The key value store.
    */ */
    public function __construct(array $configuration, $plugin_id, $plugin_definition, StateInterface $state) { public function __construct(array $configuration, $plugin_id, $plugin_definition, protected KeyValueStoreInterface $keyValue) {
    parent::__construct($configuration, $plugin_id, $plugin_definition); parent::__construct($configuration, $plugin_id, $plugin_definition);
    $this->state = $state;
    } }
    /** /**
    ...@@ -58,7 +51,7 @@ public static function create(ContainerInterface $container, array $configuratio ...@@ -58,7 +51,7 @@ public static function create(ContainerInterface $container, array $configuratio
    $configuration, $configuration,
    $plugin_id, $plugin_id,
    $plugin_definition, $plugin_definition,
    $container->get('state') $container->get('keyvalue')->get('block_test')
    ); );
    } }
    ...@@ -66,7 +59,7 @@ public static function create(ContainerInterface $container, array $configuratio ...@@ -66,7 +59,7 @@ public static function create(ContainerInterface $container, array $configuratio
    * {@inheritdoc} * {@inheritdoc}
    */ */
    protected function blockAccess(AccountInterface $account) { protected function blockAccess(AccountInterface $account) {
    return $this->state->get('test_block_access', FALSE) ? AccessResult::allowed()->setCacheMaxAge(0) : AccessResult::forbidden()->setCacheMaxAge(0); return $this->keyValue->get('access', FALSE) ? AccessResult::allowed()->setCacheMaxAge(0) : AccessResult::forbidden()->setCacheMaxAge(0);
    } }
    /** /**
    ......
    ...@@ -576,7 +576,7 @@ public function testBlockAccess(): void { ...@@ -576,7 +576,7 @@ public function testBlockAccess(): void {
    $this->drupalGet('<front>'); $this->drupalGet('<front>');
    $this->assertSession()->pageTextNotContains('Hello test world'); $this->assertSession()->pageTextNotContains('Hello test world');
    \Drupal::state()->set('test_block_access', TRUE); \Drupal::keyValue('block_test')->set('access', TRUE);
    $this->drupalGet('<front>'); $this->drupalGet('<front>');
    $this->assertSession()->pageTextContains('Hello test world'); $this->assertSession()->pageTextContains('Hello test world');
    } }
    ......
    ...@@ -197,7 +197,7 @@ public function testLayoutSectionFormatterAccess(): void { ...@@ -197,7 +197,7 @@ public function testLayoutSectionFormatterAccess(): void {
    ]); ]);
    // Restrict access to the block. // Restrict access to the block.
    $this->container->get('state')->set('test_block_access', FALSE); $this->container->get('keyvalue')->get('block_test')->set('access', FALSE);
    $this->drupalGet($node->toUrl('canonical')); $this->drupalGet($node->toUrl('canonical'));
    $this->assertLayoutSection('.layout--onecol', NULL, '', '', 'UNCACHEABLE (poor cacheability)'); $this->assertLayoutSection('.layout--onecol', NULL, '', '', 'UNCACHEABLE (poor cacheability)');
    ...@@ -205,7 +205,7 @@ public function testLayoutSectionFormatterAccess(): void { ...@@ -205,7 +205,7 @@ public function testLayoutSectionFormatterAccess(): void {
    $this->assertSession()->pageTextNotContains('Hello test world'); $this->assertSession()->pageTextNotContains('Hello test world');
    // Grant access to the block, and ensure it was rendered. // Grant access to the block, and ensure it was rendered.
    $this->container->get('state')->set('test_block_access', TRUE); $this->container->get('keyvalue')->get('block_test')->set('access', TRUE);
    $this->drupalGet($node->toUrl('canonical')); $this->drupalGet($node->toUrl('canonical'));
    $this->assertLayoutSection('.layout--onecol', 'Hello test world', '', '', 'UNCACHEABLE (poor cacheability)'); $this->assertLayoutSection('.layout--onecol', 'Hello test world', '', '', 'UNCACHEABLE (poor cacheability)');
    } }
    ......
    0% Loading or .
    You are about to add 0 people to the discussion. Proceed with caution.
    Please register or to comment