Verified Commit 49283982 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

(cherry picked from commit d43e2ba8)
parent 16039786
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -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.
+1 −1
Original line number Diff line number Diff line
@@ -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];

+1 −1
Original line number Diff line number Diff line
@@ -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.
+1 −1
Original line number Diff line number Diff line
@@ -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());
  }
+3 −3
Original line number Diff line number Diff line
@@ -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() {
Loading