assertNids example

        $node = $this->drupalCreateNode(['type' => $type->id(), 'created' => REQUEST_TIME - ($i * 5 + $j)]);
        $nodes[$type->id()][$node->id()] = $node;
        $all_nids[] = $node->id();
      }
    }

    $this->drupalGet('test-node-view');
    $this->assertSession()->statusCodeEquals(404);

    $this->drupalGet('test-node-view/all');
    $this->assertSession()->statusCodeEquals(200);
    $this->assertNids($all_nids);

    foreach ($types as $type) {
      $this->drupalGet("test-node-view/{$type->id()}");
      $this->assertSession()->assertEscaped($type->label());
      $this->assertNids(array_keys($nodes[$type->id()]));
    }
  }

  /** * Ensures that a list of nodes appear on the page. * * @param array $expected_nids * An array of node IDs. * * @internal */
Home | Imprint | This part of the site doesn't use cookies.