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

Issue #3402007 by marvil07, mstrelan, quietone, smustgrave, larowlan: Fix...

Issue #3402007 by marvil07, mstrelan, quietone, smustgrave, larowlan: Fix strict type errors in test modules
parent e9574d73
No related branches found
No related tags found
22 merge requests!12227Issue #3181946 by jonmcl, mglaman,!11131[10.4.x-only-DO-NOT-MERGE]: Issue ##2842525 Ajax attached to Views exposed filter form does not trigger callbacks,!9470[10.3.x-only-DO-NOT-MERGE]: #3331771 Fix file_get_contents(): Passing null to parameter,!8736Update the Documention As per the Function uses.,!8513Issue #3453786: DefaultSelection should document why values for target_bundles NULL and [] behave as they do,!5423Draft: Resolve #3329907 "Test2",!3878Removed unused condition head title for views,!3818Issue #2140179: $entity->original gets stale between updates,!3742Issue #3328429: Create item list field formatter for displaying ordered and unordered lists,!3731Claro: role=button on status report items,!3478Issue #3337882: Deleted menus are not removed from content type config,!3154Fixes #2987987 - CSRF token validation broken on routes with optional parameters.,!3133core/modules/system/css/components/hidden.module.css,!2964Issue #2865710 : Dependencies from only one instance of a widget are used in display modes,!2812Issue #3312049: [Followup] Fix Drupal.Commenting.FunctionComment.MissingReturnType returns for NULL,!2378Issue #2875033: Optimize joins and table selection in SQL entity query implementation,!2062Issue #3246454: Add weekly granularity to views date sort,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!877Issue #2708101: Default value for link text is not saved,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493
Pipeline #247715 passed with warnings
Pipeline: drupal

#247740

    Pipeline: drupal

    #247731

      Pipeline: drupal

      #247721

        Showing
        with 21 additions and 18 deletions
        ......@@ -20,7 +20,7 @@ public function __invoke(): \Closure {
        return function ($handler) {
        return function (RequestInterface $request, array $options) use ($handler): PromiseInterface {
        $test_end_point = \Drupal::state()->get('announce_test_endpoint');
        if ($test_end_point && str_contains($request->getUri(), '://www.drupal.org/announcements.json')) {
        if ($test_end_point && str_contains((string) $request->getUri(), '://www.drupal.org/announcements.json')) {
        // Only override $uri if it matches the advisories JSON feed to avoid
        // changing any other uses of the 'http_client' service during tests with
        // this module installed.
        ......
        ......@@ -22,7 +22,7 @@ public function testMultipleForms() {
        // see if there's only one in the tests.
        $post_render_callable = function ($elements) {
        $matches = [];
        preg_match_all('<form\s(.*?)action="(.*?)"(.*)>', $elements, $matches);
        preg_match_all('<form\s(.*?)action="(.*?)"(.*)>', (string) $elements, $matches);
        $action_values = $matches[2];
        ......
        ......@@ -18,7 +18,7 @@ public function __invoke() {
        return function ($handler) {
        return function (RequestInterface $request, array $options) use ($handler): PromiseInterface {
        $test_end_point = \Drupal::state()->get('advisories_test_endpoint');
        if ($test_end_point && str_contains($request->getUri(), '://updates.drupal.org/psa.json')) {
        if ($test_end_point && str_contains((string) $request->getUri(), '://updates.drupal.org/psa.json')) {
        // Only override $uri if it matches the advisories JSON feed to avoid
        // changing any other uses of the 'http_client' service during tests with
        // this module installed.
        ......
        ......@@ -59,7 +59,7 @@ public function testMethod() {
        * @return \Symfony\Component\HttpFoundation\Response
        * CSRF token.
        */
        public function getCsrfToken($num) {
        public function getCsrfToken(int $num) {
        sleep($num);
        return new JsonResponse($this->tokenGenerator->get());
        }
        ......
        ......@@ -94,7 +94,7 @@ public function response() {
        public function responseEarly() {
        $render_array = $this->earlyRenderContent();
        return new Response($this->renderer->render($render_array));
        return new Response((string) $this->renderer->render($render_array));
        }
        public function responseWithAttachments() {
        ......@@ -103,7 +103,7 @@ public function responseWithAttachments() {
        public function responseWithAttachmentsEarly() {
        $render_array = $this->earlyRenderContent();
        return new AttachmentsTestResponse($this->renderer->render($render_array));
        return new AttachmentsTestResponse((string) $this->renderer->render($render_array));
        }
        public function cacheableResponse() {
        ......@@ -112,7 +112,7 @@ public function cacheableResponse() {
        public function cacheableResponseEarly() {
        $render_array = $this->earlyRenderContent();
        return new CacheableTestResponse($this->renderer->render($render_array));
        return new CacheableTestResponse((string) $this->renderer->render($render_array));
        }
        public function domainObject() {
        ......
        ......@@ -61,7 +61,7 @@ public function generateWarnings($collect_errors = FALSE) {
        public function generateFatalErrors() {
        $function = function (array $test) {
        };
        // Use an incorrect parameter type, string, for testing a fatal error.
        $function("test-string");
        return [];
        }
        ......
        ......@@ -43,7 +43,10 @@ public function buildForm(array $form, FormStateInterface $form_state, $first =
        foreach ($args as $arg) {
        $name = 'button' . ++$i;
        // 's', 'b', or 'i' in the argument define the button type wanted.
        if (str_contains($arg, 's')) {
        if (!is_string($arg)) {
        $type = NULL;
        }
        elseif (str_contains($arg, 's')) {
        $type = 'submit';
        }
        elseif (str_contains($arg, 'b')) {
        ......
        ......@@ -59,7 +59,7 @@ public function buildForm(array $form, FormStateInterface $form_state) {
        * @see \Drupal\Tests\system\Functional\Form\FormTest::testInputForgery()
        */
        public static function postRender($rendered_form) {
        return str_replace('value="two"', 'value="FORGERY"', $rendered_form);
        return str_replace('value="two"', 'value="FORGERY"', (string) $rendered_form);
        }
        /**
        ......
        ......@@ -11,7 +11,7 @@ class RenderArrayNonHtmlSubscriberTestController extends ControllerBase {
        * @return string
        */
        public function rawString() {
        return new Response($this->t('Raw controller response.'));
        return new Response((string) $this->t('Raw controller response.'));
        }
        /**
        ......
        ......@@ -111,7 +111,7 @@ public function noSet($test_value) {
        */
        public function setMessage() {
        $this->messenger()->addStatus($this->t('This is a dummy message.'));
        return new Response($this->t('A message was set.'));
        return new Response((string) $this->t('A message was set.'));
        // Do not return anything, so the current request does not result in a themed
        // page with messages. The message will be displayed in the following request
        // instead.
        ......@@ -240,8 +240,8 @@ public function hasSessionBagFlag(Request $request) {
        /** @var \Drupal\session_test\Session\TestSessionBag */
        $bag = $request->getSession()->getBag(TestSessionBag::BAG_NAME);
        return new Response(empty($bag->hasFlag())
        ? $this->t('Flag is absent from session bag')
        : $this->t('Flag is present in session bag')
        ? (string) $this->t('Flag is absent from session bag')
        : (string) $this->t('Flag is present in session bag')
        );
        }
        ......
        ......@@ -27,7 +27,7 @@ class SessionTestSubscriber implements EventSubscriberInterface {
        */
        public function onKernelRequestSessionTest(RequestEvent $event) {
        $session = $event->getRequest()->getSession();
        $this->emptySession = (int) !($session && $session->start());
        $this->emptySession = !($session && $session->start());
        }
        /**
        ......@@ -39,7 +39,7 @@ public function onKernelRequestSessionTest(RequestEvent $event) {
        public function onKernelResponseSessionTest(ResponseEvent $event) {
        // Set header for session testing.
        $response = $event->getResponse();
        $response->headers->set('X-Session-Empty', $this->emptySession);
        $response->headers->set('X-Session-Empty', $this->emptySession ? '1' : '0');
        }
        /**
        ......
        ......@@ -303,7 +303,7 @@ public function setHeader(Request $request) {
        $response = new CacheableResponse();
        $response->headers->set($query['name'], $query['value']);
        $response->getCacheableMetadata()->addCacheContexts(['url.query_args:name', 'url.query_args:value']);
        $response->setContent($this->t('The following header was set: %name: %value', ['%name' => $query['name'], '%value' => $query['value']]));
        $response->setContent((string) $this->t('The following header was set: %name: %value', ['%name' => $query['name'], '%value' => $query['value']]));
        return $response;
        }
        ......
        ......@@ -85,7 +85,7 @@ public function renderPage() {
        * @param int $code
        * The status code.
        */
        public function httpResponseException($code) {
        public function httpResponseException(int $code) {
        throw new HttpException($code);
        }
        ......
        0% Loading or .
        You are about to add 0 people to the discussion. Proceed with caution.
        Please register or to comment