X-Git-Url: http://www.aleph1.co.uk/gitweb/?a=blobdiff_plain;ds=sidebyside;f=web%2Fcore%2Fmodules%2Fcomment%2Ftests%2Fsrc%2FFunctional%2FCommentNodeChangesTest.php;fp=web%2Fcore%2Fmodules%2Fcomment%2Ftests%2Fsrc%2FFunctional%2FCommentNodeChangesTest.php;h=a63ce8bc05143c7540cc80059d4276aa02c0a258;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hp=0000000000000000000000000000000000000000;hpb=aea91e65e895364e460983b890e295aa5d5540a5;p=yaffs-website diff --git a/web/core/modules/comment/tests/src/Functional/CommentNodeChangesTest.php b/web/core/modules/comment/tests/src/Functional/CommentNodeChangesTest.php new file mode 100644 index 000000000..a63ce8bc0 --- /dev/null +++ b/web/core/modules/comment/tests/src/Functional/CommentNodeChangesTest.php @@ -0,0 +1,35 @@ +drupalLogin($this->webUser); + $comment = $this->postComment($this->node, $this->randomMachineName(), $this->randomMachineName()); + $this->assertTrue($comment->id(), 'The comment could be loaded.'); + $this->node->delete(); + $this->assertFalse(Comment::load($comment->id()), 'The comment could not be loaded after the node was deleted.'); + // Make sure the comment field storage and all its fields are deleted when + // the node type is deleted. + $this->assertNotNull(FieldStorageConfig::load('node.comment'), 'Comment field storage exists'); + $this->assertNotNull(FieldConfig::load('node.article.comment'), 'Comment field exists'); + // Delete the node type. + entity_delete_multiple('node_type', [$this->node->bundle()]); + $this->assertNull(FieldStorageConfig::load('node.comment'), 'Comment field storage deleted'); + $this->assertNull(FieldConfig::load('node.article.comment'), 'Comment field deleted'); + } + +}