comparison core/modules/comment/tests/src/Kernel/CommentHostnameTest.php @ 5:12f9dff5fda9 tip

Update to Drupal core 8.7.1
author Chris Cannam
date Thu, 09 May 2019 15:34:47 +0100
parents a9cd425dd02b
children
comparison
equal deleted inserted replaced
4:a9cd425dd02b 5:12f9dff5fda9
35 35
36 CommentType::create([ 36 CommentType::create([
37 'id' => 'foo', 37 'id' => 'foo',
38 'target_entity_type_id' => 'entity_test', 38 'target_entity_type_id' => 'entity_test',
39 ])->save(); 39 ])->save();
40
41 // Check that the hostname is empty by default.
40 $comment = Comment::create(['comment_type' => 'foo']); 42 $comment = Comment::create(['comment_type' => 'foo']);
43 $this->assertEquals('', $comment->getHostname());
41 44
45 \Drupal::configFactory()
46 ->getEditable('comment.settings')
47 ->set('log_ip_addresses', TRUE)
48 ->save(TRUE);
42 // Check that the hostname was set correctly. 49 // Check that the hostname was set correctly.
50 $comment = Comment::create(['comment_type' => 'foo']);
43 $this->assertEquals('203.0.113.1', $comment->getHostname()); 51 $this->assertEquals('203.0.113.1', $comment->getHostname());
44 } 52 }
45 53
46 } 54 }