diff --git a/core/modules/action/src/Tests/BulkFormTest.php b/core/modules/action/src/Tests/BulkFormTest.php index 0184c0d..41d3245 100644 --- a/core/modules/action/src/Tests/BulkFormTest.php +++ b/core/modules/action/src/Tests/BulkFormTest.php @@ -9,7 +9,6 @@ use Drupal\simpletest\WebTestBase; use Drupal\views\Views; -use Drupal\node\Entity\Node; /** * Tests the views bulk form test. @@ -69,14 +68,14 @@ public function testBulkForm() { $this->drupalPostForm(NULL, $edit, t('Apply')); foreach ($nodes as $node) { - $changed_node = Node::load($node->id()); + $changed_node = $node_storage->load($node->id()); $this->assertTrue($changed_node->isSticky(), format_string('Node @nid got marked as sticky.', array('@nid' => $node->id()))); } $this->assertText('Make content sticky was applied to 10 items.'); // Unpublish just one node. - $node = Node::load($nodes[0]->id()); + $node = $node_storage->load($nodes[0]->id()); $this->assertTrue($node->isPublished(), 'The node is published.'); $edit = array('node_bulk_form[0]' => TRUE, 'action' => 'node_unpublish_action'); @@ -86,12 +85,12 @@ public function testBulkForm() { // Load the node again. $node_storage->resetCache(array($node->id())); - $node = Node::load($node->id()); + $node = $node_storage->load($node->id()); $this->assertFalse($node->isPublished(), 'A single node has been unpublished.'); // The second node should still be published. $node_storage->resetCache(array($nodes[1]->id())); - $node = Node::load($nodes[1]->id()); + $node = $node_storage->load($nodes[1]->id()); $this->assertTrue($node->isPublished(), 'An unchecked node is still published.'); // Set up to include just the sticky actions. diff --git a/core/modules/book/src/Tests/BookTest.php b/core/modules/book/src/Tests/BookTest.php index 8eb9d61..3097ede 100644 --- a/core/modules/book/src/Tests/BookTest.php +++ b/core/modules/book/src/Tests/BookTest.php @@ -9,7 +9,6 @@ use Drupal\Core\Entity\EntityInterface; use Drupal\simpletest\WebTestBase; -use Drupal\node\Entity\Node; /** * Create a book, add pages, and test book interface. @@ -418,7 +417,7 @@ function testBookDelete() { $this->assertResponse('403', 'Deleting top-level book node properly forbidden.'); $this->drupalPostForm('node/' . $nodes[4]->id() . '/outline/remove', $edit, t('Remove')); $node_storage->resetCache(array($nodes[4]->id())); - $node4 = Node::load($nodes[4]->id()); + $node4 = $node_storage->load($nodes[4]->id()); $this->assertTrue(empty($node4->book), 'Deleting child book node properly allowed.'); // Delete all child book nodes and retest top-level node deletion. @@ -428,7 +427,7 @@ function testBookDelete() { entity_delete_multiple('node', $nids); $this->drupalPostForm('node/' . $this->book->id() . '/outline/remove', $edit, t('Remove')); $node_storage->resetCache(array($this->book->id())); - $node = Node::load($this->book->id()); + $node = $node_storage->load($this->book->id()); $this->assertTrue(empty($node->book), 'Deleting childless top-level book node properly allowed.'); } diff --git a/core/modules/comment/src/Tests/CommentStatisticsTest.php b/core/modules/comment/src/Tests/CommentStatisticsTest.php index 89e29f2..ea93f94 100644 --- a/core/modules/comment/src/Tests/CommentStatisticsTest.php +++ b/core/modules/comment/src/Tests/CommentStatisticsTest.php @@ -9,7 +9,6 @@ use Drupal\comment\CommentManagerInterface; use Drupal\comment\Entity\Comment; -use Drupal\node\Entity\Node; /** * Tests comment statistics on nodes. @@ -47,7 +46,7 @@ function testCommentNodeCommentStatistics() { $this->drupalLogout(); // Checks the initial values of node comment statistics with no comment. - $node = Node::load($this->node->id()); + $node = $node_storage->load($this->node->id()); $this->assertEqual($node->get('comment')->last_comment_timestamp, $this->node->getCreatedTime(), 'The initial value of node last_comment_timestamp is the node created date.'); $this->assertEqual($node->get('comment')->last_comment_name, NULL, 'The initial value of node last_comment_name is NULL.'); $this->assertEqual($node->get('comment')->last_comment_uid, $this->web_user->id(), 'The initial value of node last_comment_uid is the node uid.'); @@ -61,7 +60,7 @@ function testCommentNodeCommentStatistics() { // Checks the new values of node comment statistics with comment #1. // The node cache needs to be reset before reload. $node_storage->resetCache(array($this->node->id())); - $node = Node::load($this->node->id()); + $node = $node_storage->load($this->node->id()); $this->assertEqual($node->get('comment')->last_comment_name, NULL, 'The value of node last_comment_name is NULL.'); $this->assertEqual($node->get('comment')->last_comment_uid, $this->web_user2->id(), 'The value of node last_comment_uid is the comment #1 uid.'); $this->assertEqual($node->get('comment')->comment_count, 1, 'The value of node comment_count is 1.'); @@ -85,7 +84,7 @@ function testCommentNodeCommentStatistics() { // ensure they haven't changed since the comment has not been moderated. // The node needs to be reloaded with the cache reset. $node_storage->resetCache(array($this->node->id())); - $node = Node::load($this->node->id()); + $node = $node_storage->load($this->node->id()); $this->assertEqual($node->get('comment')->last_comment_name, NULL, 'The value of node last_comment_name is still NULL.'); $this->assertEqual($node->get('comment')->last_comment_uid, $this->web_user2->id(), 'The value of node last_comment_uid is still the comment #1 uid.'); $this->assertEqual($node->get('comment')->comment_count, 1, 'The value of node comment_count is still 1.'); @@ -107,7 +106,7 @@ function testCommentNodeCommentStatistics() { // Checks the new values of node comment statistics with comment #3. // The node needs to be reloaded with the cache reset. $node_storage->resetCache(array($this->node->id())); - $node = Node::load($this->node->id()); + $node = $node_storage->load($this->node->id()); $this->assertEqual($node->get('comment')->last_comment_name, $comment_loaded->getAuthorName(), 'The value of node last_comment_name is the name of the anonymous user.'); $this->assertEqual($node->get('comment')->last_comment_uid, 0, 'The value of node last_comment_uid is zero.'); $this->assertEqual($node->get('comment')->comment_count, 2, 'The value of node comment_count is 2.'); diff --git a/core/modules/file/src/Tests/FileFieldPathTest.php b/core/modules/file/src/Tests/FileFieldPathTest.php index 846f8ce..bf166ed 100644 --- a/core/modules/file/src/Tests/FileFieldPathTest.php +++ b/core/modules/file/src/Tests/FileFieldPathTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\node\Entity\Node; - /** * Tests that files are uploaded to proper locations. * @@ -30,7 +28,7 @@ function testUploadPath() { // Check that the file was uploaded to the file root. $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); $this->assertPathMatch('public://' . $test_file->getFilename(), $node_file->getFileUri(), format_string('The file %file was uploaded to the correct path.', array('%file' => $node_file->getFileUri()))); @@ -42,7 +40,7 @@ function testUploadPath() { // Check that the file was uploaded into the subdirectory. $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id, TRUE); $this->assertPathMatch('public://foo/bar/baz/' . $test_file->getFilename(), $node_file->getFileUri(), format_string('The file %file was uploaded to the correct path.', array('%file' => $node_file->getFileUri()))); @@ -55,7 +53,7 @@ function testUploadPath() { // Check that the file was uploaded into the subdirectory. $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); // Do token replacement using the same user which uploaded the file, not // the user running the test case. diff --git a/core/modules/file/src/Tests/FileFieldRSSContentTest.php b/core/modules/file/src/Tests/FileFieldRSSContentTest.php index eec581c..7f04ac2 100644 --- a/core/modules/file/src/Tests/FileFieldRSSContentTest.php +++ b/core/modules/file/src/Tests/FileFieldRSSContentTest.php @@ -62,7 +62,7 @@ function testFileFieldRSSContent() { // Get the uploaded file from the node. $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); // Check that the RSS enclosure appears in the RSS feed. diff --git a/core/modules/file/src/Tests/FileFieldRevisionTest.php b/core/modules/file/src/Tests/FileFieldRevisionTest.php index d3c3efa..bf607ee 100644 --- a/core/modules/file/src/Tests/FileFieldRevisionTest.php +++ b/core/modules/file/src/Tests/FileFieldRevisionTest.php @@ -7,8 +7,6 @@ namespace Drupal\file\Tests; -use Drupal\node\Entity\Node; - /** * Tests creating and deleting revisions with files attached. * @@ -41,7 +39,7 @@ function testRevisions() { // Check that the file exists on disk and in the database. $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file_r1 = file_load($node->{$field_name}->target_id); $node_vid_r1 = $node->getRevisionId(); $this->assertFileExists($node_file_r1, 'New file saved to disk on node creation.'); @@ -51,7 +49,7 @@ function testRevisions() { // Upload another file to the same node in a new revision. $this->replaceNodeFile($test_file, $field_name, $nid); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file_r2 = file_load($node->{$field_name}->target_id); $node_vid_r2 = $node->getRevisionId(); $this->assertFileExists($node_file_r2, 'Replacement file exists on disk after creating new revision.'); @@ -70,7 +68,7 @@ function testRevisions() { // Check that the file is still the same as the previous revision. $this->drupalPostForm('node/' . $nid . '/edit', array('revision' => '1'), t('Save and keep published')); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file_r3 = file_load($node->{$field_name}->target_id); $node_vid_r3 = $node->getRevisionId(); $this->assertEqual($node_file_r2->id(), $node_file_r3->id(), 'Previous revision file still in place after creating a new revision without a new file.'); @@ -79,7 +77,7 @@ function testRevisions() { // Revert to the first revision and check that the original file is active. $this->drupalPostForm('node/' . $nid . '/revisions/' . $node_vid_r1 . '/revert', array(), t('Revert')); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file_r4 = file_load($node->{$field_name}->target_id); $this->assertEqual($node_file_r1->id(), $node_file_r4->id(), 'Original revision file still in place after reverting to the original revision.'); $this->assertFileIsPermanent($node_file_r4, 'Original revision file still permanent after reverting to the original revision.'); diff --git a/core/modules/file/src/Tests/FileFieldTestBase.php b/core/modules/file/src/Tests/FileFieldTestBase.php index 8b0723a..204ae56 100644 --- a/core/modules/file/src/Tests/FileFieldTestBase.php +++ b/core/modules/file/src/Tests/FileFieldTestBase.php @@ -11,7 +11,6 @@ use Drupal\field\Entity\FieldConfig; use Drupal\file\FileInterface; use Drupal\simpletest\WebTestBase; -use Drupal\node\Entity\Node; /** * Provides methods specifically for testing File module's field handling. @@ -154,7 +153,7 @@ function uploadNodeFile($file, $field_name, $nid_or_type, $new_revision = TRUE, $node->setNewRevision(); $node->save(); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $this->assertNotEqual($nid, $node->getRevisionId(), 'Node revision exists.'); } diff --git a/core/modules/file/src/Tests/FileFieldValidateTest.php b/core/modules/file/src/Tests/FileFieldValidateTest.php index 225f51f..21d93af 100644 --- a/core/modules/file/src/Tests/FileFieldValidateTest.php +++ b/core/modules/file/src/Tests/FileFieldValidateTest.php @@ -9,7 +9,6 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\field\Entity\FieldConfig; -use Drupal\node\Entity\Node; /** * Tests validation functions such as file type, max file size, max size per @@ -44,7 +43,7 @@ function testRequired() { $this->assertTrue($nid !== FALSE, format_string('uploadNodeFile(@test_file, @field_name, @type_name) succeeded', array('@test_file' => $test_file->getFileUri(), '@field_name' => $field_name, '@type_name' => $type_name))); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); $this->assertFileExists($node_file, 'File exists after uploading to the required field.'); @@ -63,7 +62,7 @@ function testRequired() { // Create a new node with the uploaded file into the multivalue field. $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); $this->assertFileExists($node_file, 'File exists after uploading to the required multiple value field.'); $this->assertFileEntryExists($node_file, 'File entry exists after uploading to the required multiple value field.'); @@ -95,7 +94,7 @@ function testFileMaxSize() { // Create a new node with the small file, which should pass. $nid = $this->uploadNodeFile($small_file, $field_name, $type_name); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); $this->assertFileExists($node_file, format_string('File exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->getSize()), '%maxsize' => $max_filesize))); $this->assertFileEntryExists($node_file, format_string('File entry exists after uploading a file (%filesize) under the max limit (%maxsize).', array('%filesize' => format_size($small_file->getSize()), '%maxsize' => $max_filesize))); @@ -112,7 +111,7 @@ function testFileMaxSize() { // Upload the big file successfully. $nid = $this->uploadNodeFile($large_file, $field_name, $type_name); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); $this->assertFileExists($node_file, format_string('File exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->getSize())))); $this->assertFileEntryExists($node_file, format_string('File entry exists after uploading a file (%filesize) with no max limit.', array('%filesize' => format_size($large_file->getSize())))); @@ -136,7 +135,7 @@ function testFileExtension() { // Check that the file can be uploaded with no extension checking. $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); $this->assertFileExists($node_file, 'File exists after uploading a file with no extension checking.'); $this->assertFileEntryExists($node_file, 'File entry exists after uploading a file with no extension checking.'); @@ -155,7 +154,7 @@ function testFileExtension() { // Check that the file can be uploaded with extension checking. $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); $this->assertFileExists($node_file, 'File exists after uploading a file with extension checking.'); $this->assertFileEntryExists($node_file, 'File entry exists after uploading a file with extension checking.'); diff --git a/core/modules/file/src/Tests/FileFieldWidgetTest.php b/core/modules/file/src/Tests/FileFieldWidgetTest.php index d353327..fb3165b 100644 --- a/core/modules/file/src/Tests/FileFieldWidgetTest.php +++ b/core/modules/file/src/Tests/FileFieldWidgetTest.php @@ -9,7 +9,6 @@ use Drupal\comment\Entity\Comment; use Drupal\field\Entity\FieldConfig; -use Drupal\node\Entity\Node; /** * Tests the file field widget, single and multi-valued, with and without AJAX, @@ -44,7 +43,7 @@ function testSingleValuedWidget() { // does not yet support file uploads. $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); $this->assertFileExists($node_file, 'New file saved to disk on node creation.'); @@ -78,7 +77,7 @@ function testSingleValuedWidget() { // Save the node and ensure it does not have the file. $this->drupalPostForm(NULL, array(), t('Save and keep published')); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $this->assertTrue(empty($node->{$field_name}->target_id), 'File was successfully removed from the node.'); } } @@ -197,7 +196,7 @@ function testMultiValuedWidget() { preg_match('/node\/([0-9]+)/', $this->getUrl(), $matches); $nid = $matches[1]; $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $this->assertTrue(empty($node->{$field_name}->target_id), 'Node was successfully saved without any files.'); } } @@ -222,7 +221,7 @@ function testPrivateFileSetting() { $this->drupalPostForm("admin/structure/types/manage/$type_name/fields/$field->id/storage", $edit, t('Save field settings')); $nid = $this->uploadNodeFile($test_file, $field_name, $type_name); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); $this->assertFileExists($node_file, 'New file saved to disk on node creation.'); diff --git a/core/modules/file/src/Tests/FilePrivateTest.php b/core/modules/file/src/Tests/FilePrivateTest.php index 1e3dde0..ac504b1 100644 --- a/core/modules/file/src/Tests/FilePrivateTest.php +++ b/core/modules/file/src/Tests/FilePrivateTest.php @@ -6,8 +6,8 @@ */ namespace Drupal\file\Tests; + use Drupal\file\Entity\File; -use Drupal\node\Entity\Node; /** * Uploads a test to a private node and checks access. @@ -47,7 +47,7 @@ function testPrivateFile() { $test_file = $this->getTestFile('text'); $nid = $this->uploadNodeFile($test_file, $field_name, $type_name, TRUE, array('private' => TRUE)); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = file_load($node->{$field_name}->target_id); // Ensure the file can be downloaded. $this->drupalGet(file_create_url($node_file->getFileUri())); @@ -60,7 +60,7 @@ function testPrivateFile() { $this->drupalLogin($this->admin_user); $nid = $this->uploadNodeFile($test_file, $no_access_field_name, $type_name, TRUE, array('private' => TRUE)); \Drupal::entityManager()->getStorage('node')->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $node_file = File::load($node->{$no_access_field_name}->target_id); // Ensure the file cannot be downloaded. diff --git a/core/modules/file/src/Tests/FileTokenReplaceTest.php b/core/modules/file/src/Tests/FileTokenReplaceTest.php index 84be5c6..0fb438c 100644 --- a/core/modules/file/src/Tests/FileTokenReplaceTest.php +++ b/core/modules/file/src/Tests/FileTokenReplaceTest.php @@ -8,7 +8,6 @@ namespace Drupal\file\Tests; use Drupal\Component\Utility\String; -use Drupal\node\Entity\Node; /** * Generates text using placeholders for dummy content to check file token @@ -40,7 +39,7 @@ function testFileTokenReplacement() { // Load the node and the file. $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $file = file_load($node->{$field_name}->target_id); // Generate and test sanitized tokens. diff --git a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php index 9ffc3f1..f3f2aa7 100644 --- a/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php +++ b/core/modules/image/src/Tests/ImageFieldDefaultImagesTest.php @@ -6,8 +6,8 @@ */ namespace Drupal\image\Tests; + use Drupal\file\Entity\File; -use Drupal\node\Entity\Node; /** * Tests setting up default images both to the field and field field. @@ -191,8 +191,8 @@ public function testDefaultImages() { // Reload the nodes and confirm the field field defaults are used. $node_storage->resetCache(array($article->id(), $page->id())); - $article_built = $this->drupalBuildEntityView($article = Node::load($article->id())); - $page_built = $this->drupalBuildEntityView($page = Node::load($page->id())); + $article_built = $this->drupalBuildEntityView($article = $node_storage->load($article->id())); + $page_built = $this->drupalBuildEntityView($page = $node_storage->load($page->id())); $this->assertEqual( $article_built[$field_name]['#items'][0]->target_id, $default_images['field']->id(), @@ -228,8 +228,8 @@ public function testDefaultImages() { // Reload the nodes. $node_storage->resetCache(array($article->id(), $page->id())); - $article_built = $this->drupalBuildEntityView($article = Node::load($article->id())); - $page_built = $this->drupalBuildEntityView($page = Node::load($page->id())); + $article_built = $this->drupalBuildEntityView($article = $node_storage->load($article->id())); + $page_built = $this->drupalBuildEntityView($page = $node_storage->load($page->id())); // Confirm the article uses the new default. $this->assertEqual( @@ -269,8 +269,8 @@ public function testDefaultImages() { // Reload the nodes. $node_storage->resetCache(array($article->id(), $page->id())); - $article_built = $this->drupalBuildEntityView($article = Node::load($article->id())); - $page_built = $this->drupalBuildEntityView($page = Node::load($page->id())); + $article_built = $this->drupalBuildEntityView($article = $node_storage->load($article->id())); + $page_built = $this->drupalBuildEntityView($page = $node_storage->load($page->id())); // Confirm the article uses the new field (not field) default. $this->assertEqual( $article_built[$field_name]['#items'][0]->target_id, diff --git a/core/modules/image/src/Tests/ImageFieldDisplayTest.php b/core/modules/image/src/Tests/ImageFieldDisplayTest.php index bac9338..f6ca758 100644 --- a/core/modules/image/src/Tests/ImageFieldDisplayTest.php +++ b/core/modules/image/src/Tests/ImageFieldDisplayTest.php @@ -9,7 +9,6 @@ use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\field\Entity\FieldStorageConfig; -use Drupal\node\Entity\Node; /** * Tests the display of image fields. @@ -60,7 +59,7 @@ function _testImageFieldFormatters($scheme) { // Save node. $nid = $this->uploadNodeImage($test_image, $field_name, 'article'); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); // Test that the default formatter is being used. $image_uri = file_load($node->{$field_name}->target_id)->getFileUri(); @@ -200,7 +199,7 @@ function testImageFieldSettings() { // Verify that the attached image is being previewed using the 'medium' // style. $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $image_style = array( '#theme' => 'image_style', '#uri' => file_load($node->{$field_name}->target_id)->getFileUri(), @@ -320,7 +319,7 @@ function testImageFieldDefaultImage() { // is not displayed. $nid = $this->uploadNodeImage($images[1], $field_name, 'article'); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); $image = array( '#theme' => 'image', '#uri' => file_load($node->{$field_name}->target_id)->getFileUri(), diff --git a/core/modules/node/src/Tests/NodeFormButtonsTest.php b/core/modules/node/src/Tests/NodeFormButtonsTest.php index a7a0dbe..462dc65 100644 --- a/core/modules/node/src/Tests/NodeFormButtonsTest.php +++ b/core/modules/node/src/Tests/NodeFormButtonsTest.php @@ -7,8 +7,6 @@ namespace Drupal\node\Tests; -use Drupal\node\Entity\Node; - /** * Tests all the different buttons on the node form. * @@ -47,7 +45,7 @@ function testNodeFormButtons() { $this->drupalPostForm('node/add/article', $edit, t('Save and publish')); // Get the node. - $node_1 = Node::load(1); + $node_1 = $node_storage->load(1); $this->assertTrue($node_1->isPublished(), 'Node is published'); // Verify the buttons on a node edit form. @@ -58,14 +56,14 @@ function testNodeFormButtons() { // 'Save and keep published'. $this->drupalPostForm(NULL, $edit, t('Save and keep published')); $node_storage->resetCache(array(1)); - $node_1 = Node::load(1); + $node_1 = $node_storage->load(1); $this->assertTrue($node_1->isPublished(), 'Node is published'); // Save the node and verify it's unpublished after clicking // 'Save and unpublish'. $this->drupalPostForm('node/' . $node_1->id() . '/edit', $edit, t('Save and unpublish')); $node_storage->resetCache(array(1)); - $node_1 = Node::load(1); + $node_1 = $node_storage->load(1); $this->assertFalse($node_1->isPublished(), 'Node is unpublished'); // Verify the buttons on an unpublished node edit screen. @@ -83,7 +81,7 @@ function testNodeFormButtons() { // Create the node. $edit = array('title[0][value]' => $this->randomString()); $this->drupalPostForm('node/add/article', $edit, t('Save')); - $node_2 = Node::load(2); + $node_2 = $node_storage->load(2); $this->assertTrue($node_2->isPublished(), 'Node is published'); // Login as an administrator and unpublish the node that just @@ -92,7 +90,7 @@ function testNodeFormButtons() { $this->drupalLogin($this->admin_user); $this->drupalPostForm('node/' . $node_2->id() . '/edit', array(), t('Save and unpublish')); $node_storage->resetCache(array(2)); - $node_2 = Node::load(2); + $node_2 = $node_storage->load(2); $this->assertFalse($node_2->isPublished(), 'Node is unpublished'); // Login again as the normal user, save the node and verify @@ -101,7 +99,7 @@ function testNodeFormButtons() { $this->drupalLogin($this->web_user); $this->drupalPostForm('node/' . $node_2->id() . '/edit', array(), t('Save')); $node_storage->resetCache(array(2)); - $node_2 = Node::load(2); + $node_2 = $node_storage->load(2); $this->assertFalse($node_2->isPublished(), 'Node is still unpublished'); $this->drupalLogout(); @@ -123,7 +121,7 @@ function testNodeFormButtons() { $this->drupalLogin($this->web_user); $edit = array('title[0][value]' => $this->randomString()); $this->drupalPostForm('node/add/article', $edit, t('Save')); - $node_3 = Node::load(3); + $node_3 = $node_storage->load(3); $this->assertFalse($node_3->isPublished(), 'Node is unpublished'); } diff --git a/core/modules/node/src/Tests/NodeRevisionsAllTest.php b/core/modules/node/src/Tests/NodeRevisionsAllTest.php index 8ea1fcb..854d75b 100644 --- a/core/modules/node/src/Tests/NodeRevisionsAllTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsAllTest.php @@ -7,8 +7,6 @@ namespace Drupal\node\Tests; -use Drupal\node\Entity\Node; - /** * Create a node with revisions and test viewing, saving, reverting, and * deleting revisions for user with access to all. @@ -62,7 +60,7 @@ protected function setUp() { $node->save(); $node_storage->resetCache(array($node->id())); - $node = Node::load($node->id()); // Make sure we get revision information. + $node = $node_storage->load($node->id()); // Make sure we get revision information. $nodes[] = clone $node; } @@ -117,7 +115,7 @@ function testRevisions() { )), 'Revision reverted.'); $node_storage->resetCache(array($node->id())); - $reverted_node = Node::load($node->id()); + $reverted_node = $node_storage->load($node->id()); $this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.'); // Confirm that this is not the current version. diff --git a/core/modules/node/src/Tests/NodeRevisionsTest.php b/core/modules/node/src/Tests/NodeRevisionsTest.php index 630bdd6..de5b6d9 100644 --- a/core/modules/node/src/Tests/NodeRevisionsTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsTest.php @@ -99,7 +99,7 @@ function testRevisions() { array('@type' => 'Basic page', '%title' => $nodes[1]->label(), '%revision-date' => format_date($nodes[1]->getRevisionCreationTime()))), 'Revision reverted.'); $node_storage->resetCache(array($node->id())); - $reverted_node = Node::load($node->id()); + $reverted_node = $node_storage->load($node->id()); $this->assertTrue(($nodes[1]->body->value == $reverted_node->body->value), 'Node reverted correctly.'); // Confirm that this is not the default version. @@ -181,7 +181,7 @@ function testNodeRevisionWithoutLogMessage() { $this->drupalGet('node/' . $node->id()); $this->assertText($new_title, 'New node title appears on the page.'); $node_storage->resetCache(array($node->id())); - $node_revision = Node::load($node->id()); + $node_revision = $node_storage->load($node->id()); $this->assertEqual($node_revision->revision_log->value, $revision_log, 'After an existing node revision is re-saved without a log message, the original log message is preserved.'); // Create another node with an initial revision log message. @@ -200,7 +200,7 @@ function testNodeRevisionWithoutLogMessage() { $this->drupalGet('node/' . $node->id()); $this->assertText($new_title, 'New node title appears on the page.'); $node_storage->resetCache(array($node->id())); - $node_revision = Node::load($node->id()); + $node_revision = $node_storage->load($node->id()); $this->assertTrue(empty($node_revision->revision_log->value), 'After a new node revision is saved with an empty log message, the log message for the node is empty.'); } } diff --git a/core/modules/node/src/Tests/NodeRevisionsUiTest.php b/core/modules/node/src/Tests/NodeRevisionsUiTest.php index f2c991f..2438b60 100644 --- a/core/modules/node/src/Tests/NodeRevisionsUiTest.php +++ b/core/modules/node/src/Tests/NodeRevisionsUiTest.php @@ -7,8 +7,6 @@ namespace Drupal\node\Tests; -use Drupal\node\Entity\Node; - /** * Tests the UI for controlling node revision behavior. * @@ -58,7 +56,7 @@ function testNodeFormSaveWithoutRevision() { // Load the node again and check the revision is the same as before. $node_storage->resetCache(array($node->id())); - $node_revision = Node::load($node->id(), TRUE); + $node_revision = $node_storage->load($node->id(), TRUE); $this->assertEqual($node_revision->getRevisionId(), $node->getRevisionId(), "After an existing node is saved with 'Create new revision' unchecked, a new revision is not created."); // Verify the checkbox is checked on the node edit form. @@ -71,7 +69,7 @@ function testNodeFormSaveWithoutRevision() { // Load the node again and check the revision is different from before. $node_storage->resetCache(array($node->id())); - $node_revision = Node::load($node->id()); + $node_revision = $node_storage->load($node->id()); $this->assertNotEqual($node_revision->getRevisionId(), $node->getRevisionId(), "After an existing node is saved with 'Create new revision' checked, a new revision is created."); } diff --git a/core/modules/node/src/Tests/PageEditTest.php b/core/modules/node/src/Tests/PageEditTest.php index 4dbad60..1623a5f 100644 --- a/core/modules/node/src/Tests/PageEditTest.php +++ b/core/modules/node/src/Tests/PageEditTest.php @@ -7,8 +7,6 @@ namespace Drupal\node\Tests; -use Drupal\node\Entity\Node; - /** * Create a node and test node edit functionality. * @@ -118,7 +116,7 @@ function testPageAuthoredBy() { $edit['uid[0][target_id]'] = 'Anonymous (0)'; $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); $node_storage->resetCache(array($node->id())); - $node = Node::load($node->id()); + $node = $node_storage->load($node->id()); $this->assertIdentical($node->getOwnerId(), '0', 'Node authored by anonymous user.'); // Change the authored by field to another user's name (that is not @@ -126,7 +124,7 @@ function testPageAuthoredBy() { $edit['uid[0][target_id]'] = $this->web_user->getUsername(); $this->drupalPostForm('node/' . $node->id() . '/edit', $edit, t('Save and keep published')); $node_storage->resetCache(array($node->id())); - $node = Node::load($node->id()); + $node = $node_storage->load($node->id()); $this->assertIdentical($node->getOwnerId(), $this->web_user->id(), 'Node authored by normal user.'); // Check that normal users cannot change the authored by information. diff --git a/core/modules/path/src/Tests/PathLanguageTest.php b/core/modules/path/src/Tests/PathLanguageTest.php index 9ab7053..f87b5a3 100644 --- a/core/modules/path/src/Tests/PathLanguageTest.php +++ b/core/modules/path/src/Tests/PathLanguageTest.php @@ -7,8 +7,6 @@ namespace Drupal\path\Tests; -use Drupal\node\Entity\Node; - /** * Confirm that paths work with translated nodes. * @@ -105,7 +103,7 @@ function testAliasTranslation() { // Ensure the node was created. $node_storage->resetCache(array($english_node->id())); - $english_node = Node::load($english_node->id()); + $english_node = $node_storage->load($english_node->id()); $french_node = $english_node->getTranslation('fr'); $this->assertTrue($english_node->hasTranslation('fr'), 'Node found in database.'); diff --git a/core/modules/rdf/src/Tests/FileFieldAttributesTest.php b/core/modules/rdf/src/Tests/FileFieldAttributesTest.php index 091509e..e6aea38 100644 --- a/core/modules/rdf/src/Tests/FileFieldAttributesTest.php +++ b/core/modules/rdf/src/Tests/FileFieldAttributesTest.php @@ -8,7 +8,6 @@ namespace Drupal\rdf\Tests; use Drupal\file\Tests\FileFieldTestBase; -use Drupal\node\Entity\Node; /** * Tests the RDFa markup of filefields. @@ -68,7 +67,7 @@ protected function setUp() { $nid = $this->uploadNodeFile($test_file, $this->fieldName, $type_name); $node_storage->resetCache(array($nid)); - $this->node = Node::load($nid); + $this->node = $node_storage->load($nid); $this->file = file_load($this->node->{$this->fieldName}->target_id); } diff --git a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php index e747f26..f26e9c8 100644 --- a/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php +++ b/core/modules/responsive_image/src/Tests/ResponsiveImageFieldDisplayTest.php @@ -8,7 +8,6 @@ namespace Drupal\responsive_image\Tests; use Drupal\image\Tests\ImageFieldTestBase; -use Drupal\node\Entity\Node; /** * Tests responsive image display formatter. @@ -87,7 +86,7 @@ public function _testResponsiveImageFieldFormatters($scheme) { $test_image = current($this->drupalGetTestFiles('image')); $nid = $this->uploadNodeImage($test_image, $field_name, 'article'); $node_storage->resetCache(array($nid)); - $node = Node::load($nid); + $node = $node_storage->load($nid); // Test that the default formatter is being used. $image_uri = file_load($node->{$field_name}->target_id)->getFileUri(); diff --git a/core/modules/rest/src/Tests/NodeTest.php b/core/modules/rest/src/Tests/NodeTest.php index 215fe95..8e59e02 100644 --- a/core/modules/rest/src/Tests/NodeTest.php +++ b/core/modules/rest/src/Tests/NodeTest.php @@ -8,7 +8,6 @@ namespace Drupal\rest\Tests; use Drupal\rest\Tests\RESTTestBase; -use Drupal\node\Entity\Node; /** * Tests special cases for node entities. @@ -85,7 +84,7 @@ public function testNodes() { // Reload the node from the DB and check if the title was correctly updated. $node_storage->resetCache(array($node->id())); - $updated_node = Node::load($node->id()); + $updated_node = $node_storage->load($node->id()); $this->assertEqual($updated_node->getTitle(), $new_title); // Make sure that the UUID of the node has not changed. $this->assertEqual($node->get('uuid')->getValue(), $updated_node->get('uuid')->getValue(), 'UUID was not changed.'); diff --git a/core/modules/search/src/Tests/SearchCommentTest.php b/core/modules/search/src/Tests/SearchCommentTest.php index 0bc5e0a..0953c36 100644 --- a/core/modules/search/src/Tests/SearchCommentTest.php +++ b/core/modules/search/src/Tests/SearchCommentTest.php @@ -10,7 +10,6 @@ use Drupal\comment\Plugin\Field\FieldType\CommentItemInterface; use Drupal\Component\Utility\String; use Drupal\field\Entity\FieldConfig; -use Drupal\node\Entity\Node; /** * Tests integration searching comments. @@ -108,7 +107,7 @@ function testSearchResultsComment() { ); $this->drupalPostForm('search/node', $edit, t('Search')); $node_storage->resetCache(array($node->id())); - $node2 = Node::load($node->id()); + $node2 = $node_storage->load($node->id()); $this->assertText($node2->label(), 'Node found in search results.'); $this->assertText($edit_comment['subject[0][value]'], 'Comment subject found in search results.'); diff --git a/core/modules/system/form.api.php b/core/modules/system/form.api.php index bd9141e..f6d19da 100644 --- a/core/modules/system/form.api.php +++ b/core/modules/system/form.api.php @@ -6,7 +6,6 @@ */ use Drupal\Component\Utility\String; -use Drupal\node\Entity\Node; /** * @addtogroup callbacks @@ -74,7 +73,7 @@ function callback_batch_operation($MULTIPLE_PARAMS, &$context) { // Here we actually perform our processing on the current node. $node_storage->resetCache(array($row['nid'])); - $node = Node::load($row['nid']); + $node = $node_storage->load($row['nid']); $node->value1 = $options1; $node->value2 = $options2; node_save($node); diff --git a/core/modules/taxonomy/src/Tests/TermIndexTest.php b/core/modules/taxonomy/src/Tests/TermIndexTest.php index 04902dd..e2e5964 100644 --- a/core/modules/taxonomy/src/Tests/TermIndexTest.php +++ b/core/modules/taxonomy/src/Tests/TermIndexTest.php @@ -9,7 +9,6 @@ use Drupal\Core\Field\FieldDefinitionInterface; use Drupal\Core\Field\FieldStorageDefinitionInterface; -use Drupal\node\Entity\Node; /** * Tests the hook implementations that maintain the taxonomy index. @@ -157,7 +156,7 @@ function testTaxonomyIndex() { // Redo the above tests without interface. $node_storage->resetCache(array($node->id())); - $node = Node::load($node->id()); + $node = $node_storage->load($node->id()); $node->title = $this->randomMachineName(); // Update the article with no term changed. diff --git a/core/modules/user/src/Tests/UserCancelTest.php b/core/modules/user/src/Tests/UserCancelTest.php index 506ff2a..c9cba54 100644 --- a/core/modules/user/src/Tests/UserCancelTest.php +++ b/core/modules/user/src/Tests/UserCancelTest.php @@ -10,7 +10,6 @@ use Drupal\simpletest\WebTestBase; use Drupal\comment\CommentInterface; use Drupal\comment\Entity\Comment; -use Drupal\node\Entity\Node; /** * Ensure that account cancellation methods work as expected. @@ -61,7 +60,7 @@ function testUserCancelWithoutPermission() { // Confirm user's content has not been altered. $node_storage->resetCache(array($node->id())); - $test_node = Node::load($node->id()); + $test_node = $node_storage->load($node->id()); $this->assertTrue(($test_node->getOwnerId() == $account->id() && $test_node->isPublished()), 'Node of the user has not been altered.'); } @@ -144,7 +143,7 @@ function testUserCancelInvalid() { // Confirm user's content has not been altered. $node_storage->resetCache(array($node->id())); - $test_node = Node::load($node->id()); + $test_node = $node_storage->load($node->id()); $this->assertTrue(($test_node->getOwnerId() == $account->id() && $test_node->isPublished()), 'Node of the user has not been altered.'); } @@ -236,7 +235,7 @@ function testUserBlockUnpublish() { // Confirm user's content has been unpublished. $node_storage->resetCache(array($node->id())); - $test_node = Node::load($node->id()); + $test_node = $node_storage->load($node->id()); $this->assertFalse($test_node->isPublished(), 'Node of the user has been unpublished.'); $test_node = node_revision_load($node->getRevisionId()); $this->assertFalse($test_node->isPublished(), 'Node revision of the user has been unpublished.'); @@ -292,12 +291,12 @@ function testUserAnonymize() { // Confirm that user's content has been attributed to anonymous user. $node_storage->resetCache(array($node->id())); - $test_node = Node::load($node->id()); + $test_node = $node_storage->load($node->id()); $this->assertTrue(($test_node->getOwnerId() == 0 && $test_node->isPublished()), 'Node of the user has been attributed to anonymous user.'); $test_node = node_revision_load($revision, TRUE); $this->assertTrue(($test_node->getRevisionAuthor()->id() == 0 && $test_node->isPublished()), 'Node revision of the user has been attributed to anonymous user.'); $node_storage->resetCache(array($revision_node->id())); - $test_node = Node::load($revision_node->id()); + $test_node = $node_storage->load($revision_node->id()); $this->assertTrue(($test_node->getOwnerId() != 0 && $test_node->isPublished()), "Current revision of the user's node was not attributed to anonymous user."); // Confirm that the confirmation message made it through to the end user. @@ -361,10 +360,10 @@ function testUserDelete() { // Confirm that user's content has been deleted. $node_storage->resetCache(array($node->id())); - $this->assertFalse(Node::load($node->id()), 'Node of the user has been deleted.'); + $this->assertFalse($node_storage->load($node->id()), 'Node of the user has been deleted.'); $this->assertFalse(node_revision_load($revision), 'Node revision of the user has been deleted.'); $node_storage->resetCache(array($revision_node->id())); - $this->assertTrue(Node::load($revision_node->id()), "Current revision of the user's node was not deleted."); + $this->assertTrue($node_storage->load($revision_node->id()), "Current revision of the user's node was not deleted."); \Drupal::entityManager()->getStorage('comment')->resetCache(array($comment->id())); $this->assertFalse(Comment::load($comment->id()), 'Comment of the user has been deleted.');