Verified Commit 02c2f2c1 authored by quietone's avatar quietone
Browse files

Issue #3404508 by mstrelan, smustgrave, larowlan, quietone: Fix strict type...

Issue #3404508 by mstrelan, smustgrave, larowlan, quietone: Fix strict type errors in Functional tests: Add casts and fix types where needed
parent 5ccf44d2
Loading
Loading
Loading
Loading
Loading
+20 −20
Original line number Diff line number Diff line
@@ -81,19 +81,19 @@ public function testNoJsDetection() {

    // 1. No session (anonymous).
    $this->drupalGet(Url::fromRoute('<front>'));
    $this->assertSessionCookieExists(FALSE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertSessionCookieExists('0');
    $this->assertBigPipeNoJsCookieExists('0');
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseNotContains($no_js_to_js_markup);

    // 2. Session (authenticated).
    $this->drupalLogin($this->rootUser);
    $this->assertSessionCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertSessionCookieExists('1');
    $this->assertBigPipeNoJsCookieExists('0');
    $this->assertSession()->responseContains('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . UrlHelper::encodePath(base_path() . 'user/1?check_logged_in=1') . '" />' . "\n" . '</noscript>');
    $this->assertSession()->responseNotContains($no_js_to_js_markup);
    $this->assertBigPipeNoJsMetaRefreshRedirect();
    $this->assertBigPipeNoJsCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists('1');
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseContains($no_js_to_js_markup);
    $this->drupalLogout();
@@ -104,12 +104,12 @@ public function testNoJsDetection() {
    // 3. Session (anonymous).
    $this->drupalGet(Url::fromRoute('user.login', [], ['query' => ['trigger_session' => 1]]));
    $this->drupalGet(Url::fromRoute('user.login'));
    $this->assertSessionCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertSessionCookieExists('1');
    $this->assertBigPipeNoJsCookieExists('0');
    $this->assertSession()->responseContains('<noscript><meta http-equiv="Refresh" content="0; URL=' . base_path() . 'big_pipe/no-js?destination=' . base_path() . 'user/login" />' . "\n" . '</noscript>');
    $this->assertSession()->responseNotContains($no_js_to_js_markup);
    $this->assertBigPipeNoJsMetaRefreshRedirect();
    $this->assertBigPipeNoJsCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists('1');
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseContains($no_js_to_js_markup);

@@ -118,14 +118,14 @@ public function testNoJsDetection() {

    // Edge case: route with '_no_big_pipe' option.
    $this->drupalGet(Url::fromRoute('no_big_pipe'));
    $this->assertSessionCookieExists(FALSE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertSessionCookieExists('0');
    $this->assertBigPipeNoJsCookieExists('0');
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseNotContains($no_js_to_js_markup);
    $this->drupalLogin($this->rootUser);
    $this->drupalGet(Url::fromRoute('no_big_pipe'));
    $this->assertSessionCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertSessionCookieExists('1');
    $this->assertBigPipeNoJsCookieExists('0');
    $this->assertSession()->responseNotContains('<noscript><meta http-equiv="Refresh" content="0; URL=');
    $this->assertSession()->responseNotContains($no_js_to_js_markup);
  }
@@ -145,8 +145,8 @@ public function testBigPipe() {
    $this->config('system.logging')->set('error_level', ERROR_REPORTING_HIDE)->save();

    $this->drupalLogin($this->rootUser);
    $this->assertSessionCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertSessionCookieExists('1');
    $this->assertBigPipeNoJsCookieExists('0');

    $connection = Database::getConnection();
    $log_count = $connection->select('watchdog')->countQuery()->execute()->fetchField();
@@ -236,8 +236,8 @@ public function testBigPipeNoJs() {
    $this->config('system.logging')->set('error_level', ERROR_REPORTING_HIDE)->save();

    $this->drupalLogin($this->rootUser);
    $this->assertSessionCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertSessionCookieExists('1');
    $this->assertBigPipeNoJsCookieExists('0');

    // By calling performMetaRefresh() here, we simulate JavaScript being
    // disabled, because as far as the BigPipe module is concerned, it is
@@ -245,7 +245,7 @@ public function testBigPipeNoJs() {
    // @see setUp()
    // @see performMetaRefresh()
    $this->performMetaRefresh();
    $this->assertBigPipeNoJsCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists('1');

    $this->drupalGet(Url::fromRoute('big_pipe_test'));
    $this->assertBigPipeResponseHeadersPresent();
@@ -296,8 +296,8 @@ public function testBigPipeNoJs() {
   */
  public function testBigPipeMultiOccurrencePlaceholders() {
    $this->drupalLogin($this->rootUser);
    $this->assertSessionCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists(FALSE);
    $this->assertSessionCookieExists('1');
    $this->assertBigPipeNoJsCookieExists('0');

    // By not calling performMetaRefresh() here, we simulate JavaScript being
    // enabled, because as far as the BigPipe module is concerned, JavaScript is
@@ -321,7 +321,7 @@ public function testBigPipeMultiOccurrencePlaceholders() {
    // @see setUp()
    // @see performMetaRefresh()
    $this->performMetaRefresh();
    $this->assertBigPipeNoJsCookieExists(TRUE);
    $this->assertBigPipeNoJsCookieExists('1');
    $this->drupalGet(Url::fromRoute('big_pipe_test_multi_occurrence'));
    $this->assertSession()->pageTextContains('The count is 1.');
    $this->assertSession()->responseNotContains('The count is 2.');
+1 −1
Original line number Diff line number Diff line
@@ -117,7 +117,7 @@ protected function createBookNode($book_nid, $parent = NULL) {
    static $number = 0;

    $edit = [];
    $edit['title[0][value]'] = str_pad($number, 2, '0', STR_PAD_LEFT) . ' - test node ' . $this->randomMachineName(10);
    $edit['title[0][value]'] = str_pad((string) $number, 2, '0', STR_PAD_LEFT) . ' - test node ' . $this->randomMachineName(10);
    $edit['body[0][value]'] = 'test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
    $edit['book[bid]'] = $book_nid;

+1 −1
Original line number Diff line number Diff line
@@ -192,7 +192,7 @@ public function createBookNode($book_nid, $parent = NULL, $edit = []) {
    // Used to ensure that when sorted nodes stay in same order.
    static $number = 0;

    $edit['title[0][value]'] = str_pad($number, 2, '0', STR_PAD_LEFT) . ' - test node ' . $this->randomMachineName(10);
    $edit['title[0][value]'] = str_pad((string) $number, 2, '0', STR_PAD_LEFT) . ' - test node ' . $this->randomMachineName(10);
    $edit['body[0][value]'] = 'test body ' . $this->randomMachineName(32) . ' ' . $this->randomMachineName(32);
    $edit['book[bid]'] = $book_nid;

+5 −5
Original line number Diff line number Diff line
@@ -125,14 +125,14 @@ public function testCommentThreading() {
  /**
   * Asserts that the link to the specified parent comment is present.
   *
   * @param int $cid
   * @param string $cid
   *   The comment ID to check.
   * @param int $pid
   * @param string $pid
   *   The expected parent comment ID.
   *
   * @internal
   */
  protected function assertParentLink(int $cid, int $pid): void {
  protected function assertParentLink(string $cid, string $pid): void {
    // This pattern matches a markup structure like:
    // @code
    // <article id="comment-2">
@@ -156,12 +156,12 @@ protected function assertParentLink(int $cid, int $pid): void {
  /**
   * Asserts that the specified comment does not have a link to a parent.
   *
   * @param int $cid
   * @param string $cid
   *   The comment ID to check.
   *
   * @internal
   */
  protected function assertNoParentLink(int $cid): void {
  protected function assertNoParentLink(string $cid): void {
    $pattern = "//article[@id='comment-$cid']";
    // A parent link is always accompanied by the text "In reply to".
    $this->assertSession()->elementTextNotContains('xpath', $pattern, 'In reply to');
+1 −1
Original line number Diff line number Diff line
@@ -277,7 +277,7 @@ public function testPager() {
    // Create 51 test entities.
    for ($i = 1; $i < 52; $i++) {
      $storage->create([
        'id' => str_pad($i, 2, '0', STR_PAD_LEFT),
        'id' => str_pad((string) $i, 2, '0', STR_PAD_LEFT),
        'label' => 'Test config entity ' . $i,
        'weight' => $i,
        'protected_property' => $i,
Loading