diff --git a/core/modules/block_content/tests/src/Functional/UnpublishedBlockTest.php b/core/modules/block_content/tests/src/Functional/UnpublishedBlockTest.php index 026b0e5c21de3f4de29114cb32866931c6162f61..8f87ccacccafd5731ed93fce6520ed9d3b33b33f 100644 --- a/core/modules/block_content/tests/src/Functional/UnpublishedBlockTest.php +++ b/core/modules/block_content/tests/src/Functional/UnpublishedBlockTest.php @@ -36,7 +36,7 @@ public function testViewShowsCorrectStates() { $page = $this->getSession()->getPage(); $this->assertTrue($page->has('css', '.block-block-content' . $block_content->uuid())); - $block_content->setPublished(FALSE); + $block_content->setUnpublished(); $block_content->save(); $this->drupalGet('<front>'); diff --git a/core/modules/comment/comment.module b/core/modules/comment/comment.module index 4122e3922d5d23da7f3afe59beb809dedddf818d..b9d786e35a1c9bffacc094f436c71cdc806209ed 100644 --- a/core/modules/comment/comment.module +++ b/core/modules/comment/comment.module @@ -523,7 +523,7 @@ function comment_user_cancel($edit, $account, $method) { case 'user_cancel_block_unpublish': $comments = entity_load_multiple_by_properties('comment', ['uid' => $account->id()]); foreach ($comments as $comment) { - $comment->setPublished(CommentInterface::NOT_PUBLISHED); + $comment->setUnpublished(); $comment->save(); } break; diff --git a/core/modules/comment/src/Controller/CommentController.php b/core/modules/comment/src/Controller/CommentController.php index 526c31c908306b35ff8e7b1642bca81954ae72b6..ad821e333df1da4eb354e6918cade34d274f6158 100644 --- a/core/modules/comment/src/Controller/CommentController.php +++ b/core/modules/comment/src/Controller/CommentController.php @@ -82,7 +82,7 @@ public static function create(ContainerInterface $container) { * @return \Symfony\Component\HttpFoundation\RedirectResponse */ public function commentApprove(CommentInterface $comment) { - $comment->setPublished(TRUE); + $comment->setPublished(); $comment->save(); $this->messenger()->addStatus($this->t('Comment approved.')); diff --git a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php index ec1b268d7bd6e6f254add2205489d7f94046ec3d..fe2f7ed5b0d6f09435c86c5c0d892485d76d5b56 100644 --- a/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php +++ b/core/modules/comment/src/Plugin/Action/UnpublishByKeywordComment.php @@ -78,7 +78,7 @@ public function execute($comment = NULL) { $text = $this->renderer->renderPlain($build); foreach ($this->configuration['keywords'] as $keyword) { if (strpos($text, $keyword) !== FALSE) { - $comment->setPublished(FALSE); + $comment->setUnpublished(); $comment->save(); break; } diff --git a/core/modules/comment/src/Plugin/EntityReferenceSelection/CommentSelection.php b/core/modules/comment/src/Plugin/EntityReferenceSelection/CommentSelection.php index e806397a0e018bb00d25f46214b2dcacfd331b86..3c13776e1245764002a15a4e16a04e73819c9319 100644 --- a/core/modules/comment/src/Plugin/EntityReferenceSelection/CommentSelection.php +++ b/core/modules/comment/src/Plugin/EntityReferenceSelection/CommentSelection.php @@ -42,7 +42,7 @@ public function createNewEntity($entity_type_id, $bundle, $label, $uid) { // In order to create a referenceable comment, it needs to published. /** @var \Drupal\comment\CommentInterface $comment */ - $comment->setPublished(TRUE); + $comment->setPublished(); return $comment; } diff --git a/core/modules/comment/tests/src/Functional/CommentAccessTest.php b/core/modules/comment/tests/src/Functional/CommentAccessTest.php index 4094ec6130e7505bb271240c8c6436633ba48e28..b2e4725785ae470f3ad9769bb3a36e54d08b2e54 100644 --- a/core/modules/comment/tests/src/Functional/CommentAccessTest.php +++ b/core/modules/comment/tests/src/Functional/CommentAccessTest.php @@ -78,7 +78,7 @@ public function testCannotCommentOnEntitiesYouCannotView() { $assert->statusCodeEquals(403); // Publishing the node grants access. - $this->unpublishedNode->setPublished(TRUE)->save(); + $this->unpublishedNode->setPublished()->save(); $this->drupalGet($comment_url); $assert->statusCodeEquals(200); } @@ -112,7 +112,7 @@ public function testCannotViewCommentReplyFormOnEntitiesYouCannotView() { $assert->statusCodeEquals(403); // Publishing the node grants access. - $this->unpublishedNode->setPublished(TRUE)->save(); + $this->unpublishedNode->setPublished()->save(); $this->drupalGet($comment_url); $assert->statusCodeEquals(200); } diff --git a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php index 7342633bbcf41536e6463ca91003235e698fe599..4b9a12777d36b2ede67fb364ddde63aa16be768c 100644 --- a/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php +++ b/core/modules/comment/tests/src/Functional/CommentInterfaceTest.php @@ -166,7 +166,7 @@ public function testCommentInterface() { $this->setCommentsPerPage(50); // Attempt to reply to an unpublished comment. - $reply_loaded->setPublished(FALSE); + $reply_loaded->setUnpublished(); $reply_loaded->save(); $this->drupalGet('comment/reply/node/' . $this->node->id() . '/comment/' . $reply_loaded->id()); $this->assertResponse(403); diff --git a/core/modules/comment/tests/src/Kernel/Views/CommentLinksTest.php b/core/modules/comment/tests/src/Kernel/Views/CommentLinksTest.php index 08a326dde426d7cff72ec2dc0f6a6105e7700cdf..acd2cf6e72c4a61bec4d6636affaa34671bf0238 100644 --- a/core/modules/comment/tests/src/Kernel/Views/CommentLinksTest.php +++ b/core/modules/comment/tests/src/Kernel/Views/CommentLinksTest.php @@ -2,7 +2,6 @@ namespace Drupal\Tests\comment\Kernel\Views; -use Drupal\comment\CommentInterface; use Drupal\comment\CommentManagerInterface; use Drupal\Core\Session\AnonymousUserSession; use Drupal\Core\Url; @@ -84,7 +83,7 @@ public function testLinkApprove() { $this->assertEqual(\Drupal::l('Approve', $url), (string) $approve_comment, 'Found a comment approve link for an unapproved comment.'); // Approve the comment. - $comment->setPublished(CommentInterface::PUBLISHED); + $comment->setPublished(); $comment->save(); $view = Views::getView('test_comment'); $view->preview(); @@ -97,7 +96,7 @@ public function testLinkApprove() { // anonymous user. $account_switcher->switchTo(new AnonymousUserSession()); // Set the comment as unpublished again. - $comment->setPublished(CommentInterface::NOT_PUBLISHED); + $comment->setUnpublished(); $comment->save(); $view = Views::getView('test_comment'); @@ -168,7 +167,7 @@ public function testLinkReply() { $this->assertFalse((string) $replyto_comment, "I can't reply to an unapproved comment."); // Approve the comment. - $comment->setPublished(CommentInterface::PUBLISHED); + $comment->setPublished(); $comment->save(); $view = Views::getView('test_comment'); $view->preview(); diff --git a/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php b/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php index 2ec190d64b5d825b04d8ae626bc810e44fbe1a00..6eb3deb1c8e2f79641507e116c3450be681d36cf 100644 --- a/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php +++ b/core/modules/content_translation/tests/src/Functional/ContentTranslationOperationsTest.php @@ -98,14 +98,14 @@ public function testOperationTranslateLink() { 'access content' => TRUE, ] ); - $node->setPublished(FALSE)->save(); + $node->setUnpublished()->save(); $this->drupalGet($node->urlInfo('drupal:content-translation-overview')); $this->assertResponse(403); $this->drupalLogout(); // Ensure the 'Translate' local task does not show up anymore when disabling // translations for a content type. - $node->setPublished(TRUE)->save(); + $node->setPublished()->save(); user_role_change_permissions( Role::AUTHENTICATED_ID, [ @@ -136,7 +136,7 @@ public function testContentTranslationOverviewAccess() { $this->assertFalse(content_translation_translate_access($node)->isAllowed()); $access_control_handler->resetCache(); - $node->setPublished(TRUE); + $node->setPublished(); $node->save(); $this->assertTrue(content_translation_translate_access($node)->isAllowed()); $access_control_handler->resetCache(); diff --git a/core/modules/editor/tests/src/Functional/EditorPrivateFileReferenceFilterTest.php b/core/modules/editor/tests/src/Functional/EditorPrivateFileReferenceFilterTest.php index 816de5d6e4f7b19b0520e175e5f319f9287a4f6e..4880c85fc8e13c6a222777c2430a34ae556e87f7 100644 --- a/core/modules/editor/tests/src/Functional/EditorPrivateFileReferenceFilterTest.php +++ b/core/modules/editor/tests/src/Functional/EditorPrivateFileReferenceFilterTest.php @@ -112,7 +112,7 @@ public function testEditorPrivateFileReferenceFilter() { // When the published node is also unpublished, the image should also // become inaccessible to anonymous users. - $published_node->setPublished(FALSE)->save(); + $published_node->setUnpublished()->save(); $this->drupalGet($published_node->toUrl()); $this->assertSession()->statusCodeEquals(403); @@ -121,7 +121,7 @@ public function testEditorPrivateFileReferenceFilter() { // Disallow anonymous users to view the entity, which then should also // disallow them to view the image. - $published_node->setPublished(TRUE)->save(); + $published_node->setPublished()->save(); Role::load(RoleInterface::ANONYMOUS_ID) ->revokePermission('access content') ->save(); diff --git a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php index c0e58e04e9e5917a20001014862f9b2d032e7990..6b31790c7119814f9d4920a0c47d7e802ff97a93 100644 --- a/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php +++ b/core/modules/field/tests/src/Kernel/EntityReference/EntityReferenceItemTest.php @@ -428,7 +428,7 @@ public function testAutocreateValidation() { $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_node.0.entity'); // Publish the node and try again. - $node->setPublished(TRUE); + $node->setPublished(); $errors = $entity->validate(); $this->assertEqual(0, count($errors)); @@ -478,7 +478,7 @@ public function testAutocreateValidation() { $this->assertEqual($errors[1]->getPropertyPath(), 'field_test_node.1.target_id'); // Publish one of the nodes and try again. - $saved_unpublished_node->setPublished(TRUE); + $saved_unpublished_node->setPublished(); $saved_unpublished_node->save(); $errors = $entity->validate(); $this->assertEqual(1, count($errors)); @@ -486,7 +486,7 @@ public function testAutocreateValidation() { $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_node.0.entity'); // Publish the last invalid node and try again. - $unsaved_unpublished_node->setPublished(TRUE); + $unsaved_unpublished_node->setPublished(); $errors = $entity->validate(); $this->assertEqual(0, count($errors)); @@ -510,7 +510,7 @@ public function testAutocreateValidation() { $this->assertEqual($errors[0]->getPropertyPath(), 'field_test_comment.0.entity'); // Publish the comment and try again. - $comment->setPublished(TRUE); + $comment->setPublished(); $errors = $entity->validate(); $this->assertEqual(0, count($errors)); diff --git a/core/modules/file/src/Tests/FilePrivateTest.php b/core/modules/file/src/Tests/FilePrivateTest.php index 115b89f2ff11986a0943f268ba36dbc8319f40cc..df3b3d5aee534ebe7b69edcd9910e5208d5b7902 100644 --- a/core/modules/file/src/Tests/FilePrivateTest.php +++ b/core/modules/file/src/Tests/FilePrivateTest.php @@ -214,7 +214,7 @@ public function testPrivateFile() { $edit['files[' . $field_name . '_0]'] = $file_system->realpath($test_file->getFileUri()); $this->drupalPostForm(NULL, $edit, t('Save')); $new_node = $this->drupalGetNodeByTitle($edit['title[0][value]']); - $new_node->setPublished(FALSE); + $new_node->setUnpublished(); $new_node->save(); $file = File::load($new_node->{$field_name}->target_id); $this->assertTrue($file->isPermanent(), 'File is permanent.'); diff --git a/core/modules/node/src/NodeForm.php b/core/modules/node/src/NodeForm.php index e1201a1a9deb70c58dc8610d099e25b6a6170a7e..12f276ef17d82ab7ace7d93a204da74482e7c899 100644 --- a/core/modules/node/src/NodeForm.php +++ b/core/modules/node/src/NodeForm.php @@ -217,7 +217,7 @@ public function form(array $form, FormStateInterface $form_state) { public function updateStatus($entity_type_id, NodeInterface $node, array $form, FormStateInterface $form_state) { $element = $form_state->getTriggeringElement(); if (isset($element['#published_status'])) { - $node->setPublished($element['#published_status']); + $element['#published_status'] ? $node->setPublished() : $node->setUnpublished(); } } diff --git a/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php b/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php index 3709853335a20a0ca761639956e3e50041f8c4e2..91b60c204a223743d2f480b265680e73ec37546f 100644 --- a/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php +++ b/core/modules/node/src/Plugin/Action/UnpublishByKeywordNode.php @@ -25,7 +25,7 @@ public function execute($node = NULL) { foreach ($this->configuration['keywords'] as $keyword) { $elements = node_view(clone $node); if (strpos(\Drupal::service('renderer')->render($elements), $keyword) !== FALSE || strpos($node->label(), $keyword) !== FALSE) { - $node->setPublished(FALSE); + $node->setUnpublished(); $node->save(); break; } diff --git a/core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php b/core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php index 2f26393c2e53a8acbfbc20f457c14b7dae1a5d41..5fdb3ff859e18622f6af9307b109287e7f0cf0f9 100644 --- a/core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php +++ b/core/modules/node/src/Plugin/EntityReferenceSelection/NodeSelection.php @@ -42,7 +42,7 @@ public function createNewEntity($entity_type_id, $bundle, $label, $uid) { // In order to create a referenceable node, it needs to published. /** @var \Drupal\node\NodeInterface $node */ - $node->setPublished(TRUE); + $node->setPublished(); return $node; } diff --git a/core/modules/node/tests/src/Functional/NodeCacheTagsTest.php b/core/modules/node/tests/src/Functional/NodeCacheTagsTest.php index ca5a0a99127ae7db323f9d45de667c061d586ae5..5e8b29fe7eb57a19616de24db9ea2f52a9811b49 100644 --- a/core/modules/node/tests/src/Functional/NodeCacheTagsTest.php +++ b/core/modules/node/tests/src/Functional/NodeCacheTagsTest.php @@ -32,7 +32,7 @@ protected function createEntity() { // Create a "Llama" node. $node = Node::create(['type' => 'camelids']); $node->setTitle('Llama') - ->setPublished(TRUE) + ->setPublished() ->save(); return $node; diff --git a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php index fa0ad13b3c75b6cd3f58a0db657f869e83df8e22..6bdc065f4a9e9b0e465796a8ae0682b3e2c414fd 100644 --- a/core/modules/node/tests/src/Functional/NodeTranslationUITest.php +++ b/core/modules/node/tests/src/Functional/NodeTranslationUITest.php @@ -284,7 +284,7 @@ public function testTranslationRendering() { $translation = $node->addTranslation($langcode, $values[$langcode]); // Publish and promote the translation to frontpage. $translation->setPromoted(TRUE); - $translation->setPublished(TRUE); + $translation->setPublished(); } $node->save(); diff --git a/core/modules/rest/tests/src/Functional/EntityResource/BlockContent/BlockContentResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/BlockContent/BlockContentResourceTestBase.php index 57668179404192b9af4acafdc20ff1f9e8834e91..260511a346519b1d8fc7dbdc1a08dcae49648e99 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/BlockContent/BlockContentResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/BlockContent/BlockContentResourceTestBase.php @@ -67,7 +67,7 @@ protected function createEntity() { 'format' => 'plain_text', ], ]) - ->setPublished(FALSE); + ->setUnpublished(); $block_content->save(); return $block_content; } diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php index 768fb742a983000239048728bae19f46b58ff61e..4cbc4fce07aadb211fb7ed555fe8d085af56082a 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/Comment/CommentResourceTestBase.php @@ -107,7 +107,7 @@ protected function createEntity() { ]); $comment->setSubject('Llama') ->setOwnerId(static::$auth ? $this->account->id() : 0) - ->setPublished(TRUE) + ->setPublished() ->setCreatedTime(123456789) ->setChangedTime(123456789); $comment->save(); diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Media/MediaResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/Media/MediaResourceTestBase.php index 32cc08de640b35eea8cc0738a63e250216d52f5f..6b577fda6702d2db93e58f1f71fc7191c09683f4 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/Media/MediaResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/Media/MediaResourceTestBase.php @@ -106,7 +106,7 @@ protected function createEntity() { ]); $media ->setName('Llama') - ->setPublished(TRUE) + ->setPublished() ->setCreatedTime(123456789) ->setOwnerId(static::$auth ? $this->account->id() : 0) ->setRevisionUserId(static::$auth ? $this->account->id() : 0) diff --git a/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php b/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php index bf0ba7a59194545261c91b3dc329003af597a37c..d80feca541f528a3c22f56bc1a891df557834593 100644 --- a/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php +++ b/core/modules/rest/tests/src/Functional/EntityResource/Node/NodeResourceTestBase.php @@ -81,7 +81,7 @@ protected function createEntity() { $node = Node::create(['type' => 'camelids']); $node->setTitle('Llama') ->setOwnerId(static::$auth ? $this->account->id() : 0) - ->setPublished(TRUE) + ->setPublished() ->setCreatedTime(123456789) ->setChangedTime(123456789) ->setRevisionCreationTime(123456789) diff --git a/core/modules/taxonomy/src/Tests/RssTest.php b/core/modules/taxonomy/src/Tests/RssTest.php index 81a397d69d7dcf1bb773467953eb88fa3f155aaf..c4f48846b436e6f2911f25f988cef7fa67143d7d 100644 --- a/core/modules/taxonomy/src/Tests/RssTest.php +++ b/core/modules/taxonomy/src/Tests/RssTest.php @@ -123,7 +123,7 @@ public function testTaxonomyRss() { $this->drupalGet('taxonomy/term/all/feed'); $this->assertRaw($raw_xml, "Raw text '$raw_xml' is found."); // Unpublish the article and check that it is not shown in the feed. - $node->setPublished(FALSE)->save(); + $node->setUnpublished()->save(); $this->drupalGet('taxonomy/term/all/feed'); $this->assertNoRaw($raw_xml); } diff --git a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php index 81cc1481ee370fbb9531d96cb6344faa575f6cef..c9c92f404f2b72bab3c3fb82cbf055f2da55a8db 100644 --- a/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php +++ b/core/profiles/standard/tests/src/FunctionalJavascript/StandardJavascriptTest.php @@ -30,7 +30,7 @@ public function testBigPipe() { $node = Node::create(['type' => 'article']) ->setTitle($this->randomMachineName()) ->setPromoted(TRUE) - ->setPublished(TRUE); + ->setPublished(); $node->save(); // Front page: one placeholder, for messages. diff --git a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php index 58ea3af33eff1ea72dc6a9e40a73151b6e6e03e5..4fc41cec180a1a1ee5bc0a38a7bf0cb51252d1de 100644 --- a/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php +++ b/core/tests/Drupal/Tests/Listeners/DeprecationListenerTrait.php @@ -124,7 +124,6 @@ public static function getSkippedDeprecations() { 'AssertLegacyTrait::getAllOptions() is scheduled for removal in Drupal 9.0.0. Use $element->findAll(\'xpath\', \'option\') instead.', 'assertNoCacheTag() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseHeaderNotContains() instead. See https://www.drupal.org/node/2864029.', 'assertNoPattern() is deprecated and scheduled for removal in Drupal 9.0.0. Use $this->assertSession()->responseNotMatches($pattern) instead. See https://www.drupal.org/node/2864262.', - 'The $published parameter is deprecated since version 8.3.x and will be removed in 9.0.0.', 'The Drupal\config\Tests\AssertConfigEntityImportTrait is deprecated in Drupal 8.4.1 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\config\Traits\AssertConfigEntityImportTrait. See https://www.drupal.org/node/2916197.', 'Drupal\system\Tests\Menu\AssertBreadcrumbTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\system\Functional\Menu\AssertBreadcrumbTrait', '\Drupal\Tests\node\Functional\AssertButtonsTrait is deprecated in Drupal 8.4.0 and will be removed before Drupal 9.0.0. Instead, use \Drupal\Tests\node\Functional\AssertButtonsTrait',