Mercurial > hg > isophonics-drupal-site
comparison core/modules/comment/tests/src/Functional/CommentFieldsTest.php @ 18:af1871eacc83
Update to Drupal core 8.7.1
| author | Chris Cannam |
|---|---|
| date | Thu, 09 May 2019 15:33:08 +0100 |
| parents | 4c8ae668cc8c |
| children |
comparison
equal
deleted
inserted
replaced
| 17:129ea1e6d783 | 18:af1871eacc83 |
|---|---|
| 53 $field = FieldConfig::loadByName('comment', 'comment', 'comment_body'); | 53 $field = FieldConfig::loadByName('comment', 'comment', 'comment_body'); |
| 54 $this->assertTrue(isset($field), format_string('The comment_body field is present for comments on type @type', ['@type' => $type_name])); | 54 $this->assertTrue(isset($field), format_string('The comment_body field is present for comments on type @type', ['@type' => $type_name])); |
| 55 | 55 |
| 56 // Test adding a field that defaults to CommentItemInterface::CLOSED. | 56 // Test adding a field that defaults to CommentItemInterface::CLOSED. |
| 57 $this->addDefaultCommentField('node', 'test_node_type', 'who_likes_ponies', CommentItemInterface::CLOSED, 'who_likes_ponies'); | 57 $this->addDefaultCommentField('node', 'test_node_type', 'who_likes_ponies', CommentItemInterface::CLOSED, 'who_likes_ponies'); |
| 58 $field = FieldConfig::load('node.test_node_type.who_likes_ponies');; | 58 $field = FieldConfig::load('node.test_node_type.who_likes_ponies'); |
| 59 $this->assertEqual($field->getDefaultValueLiteral()[0]['status'], CommentItemInterface::CLOSED); | 59 $this->assertEqual($field->getDefaultValueLiteral()[0]['status'], CommentItemInterface::CLOSED); |
| 60 } | 60 } |
| 61 | 61 |
| 62 /** | 62 /** |
| 63 * Tests that you can remove a comment field. | 63 * Tests that you can remove a comment field. |
| 111 'type' => 'test_node_type', | 111 'type' => 'test_node_type', |
| 112 ]); | 112 ]); |
| 113 | 113 |
| 114 // Go to the node first so that webuser2 see new comments. | 114 // Go to the node first so that webuser2 see new comments. |
| 115 $this->drupalLogin($web_user2); | 115 $this->drupalLogin($web_user2); |
| 116 $this->drupalGet($node->urlInfo()); | 116 $this->drupalGet($node->toUrl()); |
| 117 $this->drupalLogout(); | 117 $this->drupalLogout(); |
| 118 | 118 |
| 119 // Test that buildCommentedEntityLinks() does not break when the 'comment' | 119 // Test that buildCommentedEntityLinks() does not break when the 'comment' |
| 120 // field does not exist. Requires at least one comment. | 120 // field does not exist. Requires at least one comment. |
| 121 $this->drupalLogin($this->webUser); | 121 $this->drupalLogin($this->webUser); |
| 133 \Drupal::service('router.builder')->rebuild(); | 133 \Drupal::service('router.builder')->rebuild(); |
| 134 $this->drupalGet('node'); | 134 $this->drupalGet('node'); |
| 135 | 135 |
| 136 $link_info = $this->getDrupalSettings()['comment']['newCommentsLinks']['node']['comment2']['2']; | 136 $link_info = $this->getDrupalSettings()['comment']['newCommentsLinks']['node']['comment2']['2']; |
| 137 $this->assertIdentical($link_info['new_comment_count'], 1); | 137 $this->assertIdentical($link_info['new_comment_count'], 1); |
| 138 $this->assertIdentical($link_info['first_new_comment_link'], $node->url('canonical', ['fragment' => 'new'])); | 138 $this->assertIdentical($link_info['first_new_comment_link'], $node->toUrl('canonical', ['fragment' => 'new'])->toString()); |
| 139 } | 139 } |
| 140 | 140 |
| 141 /** | 141 /** |
| 142 * Tests creating a comment field through the interface. | 142 * Tests creating a comment field through the interface. |
| 143 */ | 143 */ |
