Unverified Commit b58a924a authored by Alex Pott's avatar Alex Pott
Browse files

Issue #3170246 by paulocs, longwave: NodeLoadMultipleTest.php should be a kernel test

(cherry picked from commit 45664030)
parent 6ef840b8
Loading
Loading
Loading
Loading
+6 −19
Original line number Diff line number Diff line
<?php

namespace Drupal\Tests\node\Functional;
namespace Drupal\Tests\node\Kernel;

use Drupal\node\Entity\Node;

@@ -9,27 +9,20 @@
 *
 * @group node
 */
class NodeLoadMultipleTest extends NodeTestBase {
class NodeLoadMultipleTest extends NodeAccessTestBase {

  /**
   * Enable Views to test the frontpage against Node::loadMultiple() results.
   *
   * @var array
   * {@inheritdoc}
   */
  protected static $modules = ['views'];
  protected static $modules = ['node', 'user'];

  /**
   * {@inheritdoc}
   */
  protected $defaultTheme = 'stark';

  protected function setUp(): void {
    parent::setUp();
    $web_user = $this->drupalCreateUser([
      'create article content',
      'create page content',
    ]);
    $this->drupalLogin($web_user);

    $this->installEntitySchema('node');
  }

  /**
@@ -41,12 +34,6 @@ public function testNodeMultipleLoad() {
    $node3 = $this->drupalCreateNode(['type' => 'article', 'promote' => 0]);
    $node4 = $this->drupalCreateNode(['type' => 'page', 'promote' => 0]);

    // Confirm that promoted nodes appear in the default node listing.
    $this->drupalGet('node');
    $this->assertText($node1->label(), 'Node title appears on the default listing.');
    $this->assertText($node2->label(), 'Node title appears on the default listing.');
    $this->assertNoText($node3->label(), 'Node title does not appear in the default listing.');
    $this->assertNoText($node4->label(), 'Node title does not appear in the default listing.');
    // Load nodes with only a condition. Nodes 3 and 4 will be loaded.
    $nodes = $this->container->get('entity_type.manager')->getStorage('node')
      ->loadByProperties(['promote' => 0]);