Skip to content
Snippets Groups Projects
Commit 11edb986 authored by catch's avatar catch
Browse files

Issue #3439905 by SolimanHarkas, thebumik, smustgrave, pradhumanjain2311,...

Issue #3439905 by SolimanHarkas, thebumik, smustgrave, pradhumanjain2311, vensires, alexpott: Fix Shortcut tests that rely on UID1's super user behavior

(cherry picked from commit 46b8545d)
parent 7ec28f60
No related branches found
No related tags found
26 merge requests!122353526426-warning-for-missing,!12212Issue #3445525 by alexpott, japerry, catch, mglaman, longwave: Add BC layer...,!11958Issue #3490507 by alexpott, smustgrave: Fix bogus mocking in...,!11769Issue #3517987: Add option to contextual filters to encode slashes in query parameter.,!11185Issue #3477324 by andypost, alexpott: Fix usage of str_getcsv() and fgetcsv() for PHP 8.4,!10602Issue #3438769 by vinmayiswamy, antonnavi, michelle, amateescu: Sub workspace does not clear,!10301Issue #3469309 by mstrelan, smustgrave, moshe weitzman: Use one-time login...,!10187Issue #3487488 by dakwamine: ExtensionMimeTypeGuesser::guessMimeType must support file names with "0" (zero) like foo.0.zip,!9944Issue #3483353: Consider making the createCopy config action optionally fail...,!9929Issue #3445469 by pooja_sharma, smustgrave: Add additional test coverage for...,!9787Resolve issue 3479427 - bootstrap barrio issue under Windows,!9742Issue #3463908 by catch, quietone: Split OptionsFieldUiTest into two,!9526Issue #3458177 by mondrake, catch, quietone, godotislate, longwave, larowlan,...,!8738Issue #3424162 by camilledavis, dineshkumarbollu, smustgrave: Claro...,!8704Make greek characters available in ckeditor5,!8597Draft: Issue #3442259 by catch, quietone, dww: Reduce time of Migrate Upgrade tests...,!8533Issue #3446962 by kim.pepper: Remove incorrectly added...,!8517Issue #3443748 by NexusNovaz, smustgrave: Testcase creates false positive,!8325Update file Sort.php,!8095Expose document root on install,!7930Resolve #3427374 "Taxonomytid viewsargumentdefault plugin",!7627Issue #3439440 by nicxvan, Binoli Lalani, longwave: Remove country support from DateFormatter,!7445Issue #3440169: When using drupalGet(), provide an associative array for $headers,!6502Draft: Resolve #2938524 "Plach testing issue",!38582585169-10.1.x,!3226Issue #2987537: Custom menu link entity type should not declare "bundle" entity key
Pipeline #150953 passed with warnings
Pipeline: drupal

#151001

    Pipeline: drupal

    #150983

      Pipeline: drupal

      #150971

        +1
        ......@@ -12,6 +12,7 @@
        use Drupal\Tests\system\Functional\Entity\EntityCacheTagsTestBase;
        use Drupal\user\Entity\Role;
        use Drupal\user\RoleInterface;
        use Drupal\user\UserInterface;
        /**
        * Tests the Shortcut entity's cache tags.
        ......@@ -32,12 +33,11 @@ class ShortcutCacheTagsTest extends EntityCacheTagsTestBase {
        ];
        /**
        * {@inheritdoc}
        * User with permission to administer shortcuts.
        *
        * @todo Remove and fix test to not rely on super user.
        * @see https://www.drupal.org/project/drupal/issues/3437620
        * @var \Drupal\user\UserInterface
        */
        protected bool $usesSuperUserAccessPolicy = TRUE;
        protected UserInterface $adminUser;
        /**
        * {@inheritdoc}
        ......@@ -50,6 +50,14 @@ class ShortcutCacheTagsTest extends EntityCacheTagsTestBase {
        protected function setUp(): void {
        parent::setUp();
        $this->adminUser = $this->drupalCreateUser([
        'access toolbar',
        'access shortcuts',
        'administer site configuration',
        'administer shortcuts',
        'administer themes',
        ]);
        // Give anonymous users permission to customize shortcut links, so that we
        // can verify the cache tags of cached versions of shortcuts.
        $user_role = Role::load(RoleInterface::ANONYMOUS_ID);
        ......@@ -109,7 +117,7 @@ public function testToolbar() {
        // Ensure that without enabling the shortcuts-in-page-title-link feature
        // in the theme, the shortcut_list cache tag is not added to the page.
        $this->drupalLogin($this->rootUser);
        $this->drupalLogin($this->adminUser);
        $this->drupalGet('admin/config/system/cron');
        $expected_cache_tags = [
        'block_view',
        ......@@ -286,7 +294,7 @@ public function testBlock(): void {
        // Ensure that without enabling the shortcuts-in-page-title-link feature
        // in the theme, the shortcut_list cache tag is not added to the page.
        $this->drupalLogin($this->rootUser);
        $this->drupalLogin($this->adminUser);
        $this->drupalGet('admin/config/system/cron');
        $expected_cache_tags = [
        'CACHE_MISS_IF_UNCACHEABLE_HTTP_METHOD:form',
        ......
        ......@@ -33,11 +33,8 @@ class ShortcutLinksTest extends ShortcutTestBase {
        /**
        * {@inheritdoc}
        *
        * @todo Remove and fix test to not rely on super user.
        * @see https://www.drupal.org/project/drupal/issues/3437620
        */
        protected bool $usesSuperUserAccessPolicy = TRUE;
        protected $adminUser;
        /**
        * {@inheritdoc}
        ......@@ -50,6 +47,22 @@ class ShortcutLinksTest extends ShortcutTestBase {
        protected function setUp(): void {
        parent::setUp();
        $this->adminUser = $this->drupalCreateUser([
        'access toolbar',
        'administer shortcuts',
        'view the administration theme',
        'access content overview',
        'administer users',
        'administer site configuration',
        'administer content types',
        'create article content',
        'create page content',
        'edit any article content',
        'edit any page content',
        'administer blocks',
        'access shortcuts',
        ]);
        $this->drupalPlaceBlock('page_title_block');
        }
        ......@@ -164,7 +177,7 @@ public function testShortcutQuickLink() {
        $this->config('node.settings')->set('use_admin_theme', '1')->save();
        $this->container->get('router.builder')->rebuild();
        $this->drupalLogin($this->rootUser);
        $this->drupalLogin($this->adminUser);
        $this->drupalGet('admin/config/system/cron');
        // Test the "Add to shortcuts" link.
        ......@@ -221,8 +234,8 @@ public function testShortcutQuickLink() {
        $this->clickLink('Remove from Default shortcuts');
        $this->assertSession()->pageTextContains("The shortcut $title has been deleted.");
        $this->assertShortcutQuickLink('Add to Default shortcuts');
        \Drupal::service('module_installer')->install(['block_content']);
        $this->adminUser->addRole($this->drupalCreateRole(['administer block types']))->save();
        BlockContentType::create([
        'id' => 'basic',
        'label' => 'Basic block',
        ......@@ -284,7 +297,7 @@ public function testShortcutLinkChangePath() {
        * Tests that changing the route of a shortcut link works.
        */
        public function testShortcutLinkChangeRoute() {
        $this->drupalLogin($this->rootUser);
        $this->drupalLogin($this->adminUser);
        $this->drupalGet('admin/content');
        $this->assertSession()->statusCodeEquals(200);
        // Disable the view.
        ......@@ -360,7 +373,7 @@ public function testAccessShortcutsPermission() {
        ->save();
        // Add cron to the default shortcut set.
        $this->drupalLogin($this->rootUser);
        $this->drupalLogin($this->adminUser);
        $this->drupalGet('admin/config/system/cron');
        $this->clickLink('Add to Default shortcuts');
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment