Skip to content
Snippets Groups Projects
Verified Commit a39ed900 authored by quietone's avatar quietone
Browse files

Issue #3495574 by nikolay shapovalov, nicxvan: Move helpers in hold_test.module and delete it

parent 1c773fed
Branches
Tags
10 merge requests!11197Issue #3506427 by eduardo morales alberti: Remove responsive_image.ajax from hook,!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!10786Issue #3490579 by shalini_jha, mstrelan: Add void return to all views...,!5423Draft: Resolve #3329907 "Test2",!3818Issue #2140179: $entity->original gets stale between updates,!3478Issue #3337882: Deleted menus are not removed from content type config,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!579Issue #2230909: Simple decimals fail to pass validation
Pipeline #380282 passed with warnings
Pipeline: drupal

#380296

    Pipeline: drupal

    #380289

      Pipeline: drupal

      #380286

        ......@@ -38133,18 +38133,6 @@
        'count' => 1,
        'path' => __DIR__ . '/modules/system/tests/modules/form_test/src/FormTestServiceObject.php',
        ];
        $ignoreErrors[] = [
        'message' => '#^Function hold_test_request\\(\\) has no return type specified\\.$#',
        'identifier' => 'missingType.return',
        'count' => 1,
        'path' => __DIR__ . '/modules/system/tests/modules/hold_test/hold_test.module',
        ];
        $ignoreErrors[] = [
        'message' => '#^Function hold_test_response\\(\\) has no return type specified\\.$#',
        'identifier' => 'missingType.return',
        'count' => 1,
        'path' => __DIR__ . '/modules/system/tests/modules/hold_test/hold_test.module',
        ];
        $ignoreErrors[] = [
        'message' => '#^Method Drupal\\\\hold_test\\\\EventSubscriber\\\\HoldTestSubscriber\\:\\:hold\\(\\) has no return type specified\\.$#',
        'identifier' => 'missingType.return',
        ......@@ -6,6 +6,7 @@
        use Behat\Mink\Element\NodeElement;
        use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
        use Drupal\hold_test\HoldTestHelper;
        use Drupal\media\Entity\Media;
        /**
        ......@@ -434,11 +435,11 @@ protected function switchToMediaLibraryGrid() {
        * Switches to the table display of the widget view.
        */
        protected function switchToMediaLibraryTable() {
        hold_test_response(TRUE);
        HoldTestHelper::responseHold(TRUE);
        $this->getSession()->getPage()->clickLink('Table');
        // Assert the display change is correctly announced for screen readers.
        $this->assertAnnounceContains('Loading table view.');
        hold_test_response(FALSE);
        HoldTestHelper::responseHold(FALSE);
        $this->assertAnnounceContains('Changed to table view.');
        $this->assertMediaLibraryTable();
        }
        ......
        ......@@ -7,10 +7,12 @@
        declare(strict_types=1);
        use Drupal\hold_test\HoldTestHelper;
        /**
        * Implements hook_install().
        */
        function hold_test_install(): void {
        hold_test_request(FALSE);
        hold_test_response(FALSE);
        HoldTestHelper::requestHold(FALSE);
        HoldTestHelper::responseHold(FALSE);
        }
        <?php
        /**
        * @file
        * Contains functions for testing hold request/response.
        */
        declare(strict_types=1);
        use Drupal\hold_test\EventSubscriber\HoldTestSubscriber;
        /**
        * Request hold.
        *
        * @param bool $status
        * TRUE - enable hold, FALSE - disable hold.
        */
        function hold_test_request($status) {
        $site_path = \Drupal::getContainer()->getParameter('site.path');
        file_put_contents($site_path . '/hold_test_request.txt', $status);
        // If we're releasing the hold wait for a bit to allow the subscriber to read
        // the file.
        if (!$status) {
        usleep(HoldTestSubscriber::WAIT * 2);
        }
        }
        /**
        * Response hold.
        *
        * @param bool $status
        * TRUE - enable hold, FALSE - disable hold.
        */
        function hold_test_response($status) {
        $site_path = \Drupal::getContainer()->getParameter('site.path');
        file_put_contents($site_path . '/hold_test_response.txt', $status);
        // If we're releasing the hold wait for a bit to allow the subscriber to read
        // the file.
        if (!$status) {
        usleep(HoldTestSubscriber::WAIT * 2);
        }
        }
        <?php
        declare(strict_types=1);
        namespace Drupal\hold_test;
        use Drupal\hold_test\EventSubscriber\HoldTestSubscriber;
        /**
        * Contains methods for testing hold request/response.
        */
        class HoldTestHelper {
        /**
        * Request hold.
        *
        * @param bool $status
        * TRUE - enable hold, FALSE - disable hold.
        */
        public static function requestHold(bool $status): void {
        $site_path = \Drupal::getContainer()->getParameter('site.path');
        file_put_contents($site_path . '/hold_test_request.txt', $status);
        // If we're releasing the hold wait for a bit to allow the subscriber to
        // read the file.
        if (!$status) {
        usleep(HoldTestSubscriber::WAIT * 2);
        }
        }
        /**
        * Response hold.
        *
        * @param bool $status
        * TRUE - enable hold, FALSE - disable hold.
        */
        public static function responseHold(bool $status): void {
        $site_path = \Drupal::getContainer()->getParameter('site.path');
        file_put_contents($site_path . '/hold_test_response.txt', $status);
        // If we're releasing the hold wait for a bit to allow the subscriber to
        // read the file.
        if (!$status) {
        usleep(HoldTestSubscriber::WAIT * 2);
        }
        }
        }
        ......@@ -5,6 +5,7 @@
        namespace Drupal\FunctionalJavascriptTests\Ajax;
        use Drupal\FunctionalJavascriptTests\WebDriverTestBase;
        use Drupal\hold_test\HoldTestHelper;
        /**
        * Tests the throbber.
        ......@@ -64,28 +65,28 @@ public function testThemingThrobberElement(): void {
        // Test theming fullscreen throbber.
        $session->executeScript($custom_ajax_progress_indicator_fullscreen);
        hold_test_response(TRUE);
        HoldTestHelper::responseHold(TRUE);
        $page->clickLink('Content: Published (grouped)');
        $this->assertNotNull($web_assert->waitForElement('css', '.custom-ajax-progress-fullscreen'), 'Custom ajaxProgressIndicatorFullscreen.');
        hold_test_response(FALSE);
        HoldTestHelper::responseHold(FALSE);
        $web_assert->assertNoElementAfterWait('css', '.custom-ajax-progress-fullscreen');
        // Test theming throbber message.
        $web_assert->waitForElementVisible('css', '[data-drupal-selector="edit-options-group-info-add-group"]');
        $session->executeScript($custom_ajax_progress_message);
        hold_test_response(TRUE);
        HoldTestHelper::responseHold(TRUE);
        $page->pressButton('Add another item');
        $this->assertNotNull($web_assert->waitForElement('css', '.ajax-progress-throbber .custom-ajax-progress-message'), 'Custom ajaxProgressMessage.');
        hold_test_response(FALSE);
        HoldTestHelper::responseHold(FALSE);
        $web_assert->assertNoElementAfterWait('css', '.ajax-progress-throbber');
        // Test theming throbber.
        $web_assert->waitForElementVisible('css', '[data-drupal-selector="edit-options-group-info-group-items-3-title"]');
        $session->executeScript($custom_ajax_progress_throbber);
        hold_test_response(TRUE);
        HoldTestHelper::responseHold(TRUE);
        $page->pressButton('Add another item');
        $this->assertNotNull($web_assert->waitForElement('css', '.custom-ajax-progress-throbber'), 'Custom ajaxProgressThrobber.');
        hold_test_response(FALSE);
        HoldTestHelper::responseHold(FALSE);
        $web_assert->assertNoElementAfterWait('css', '.custom-ajax-progress-throbber');
        // Test progress throbber position on a dropbutton in a table display.
        ......@@ -93,10 +94,10 @@ public function testThemingThrobberElement(): void {
        $this->clickLink('Place block');
        $web_assert->assertWaitOnAjaxRequest();
        $this->assertNotEmpty($web_assert->waitForElementVisible('css', '#drupal-modal'));
        hold_test_response(TRUE);
        HoldTestHelper::responseHold(TRUE);
        $this->clickLink('Place block');
        $this->assertNotNull($web_assert->waitForElement('xpath', '//div[contains(@class, "dropbutton-wrapper")]/following-sibling::div[contains(@class, "ajax-progress-throbber")]'));
        hold_test_response(FALSE);
        HoldTestHelper::responseHold(FALSE);
        $web_assert->assertNoElementAfterWait('css', '.ajax-progress-throbber');
        }
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment