You are here

public function RdfCommentStorageLoadTest::testRdfCommentStorageLoad in Drupal 9

Same name and namespace in other branches
  1. 8 core/modules/rdf/tests/src/Kernel/RdfCommentStorageLoadTest.php \Drupal\Tests\rdf\Kernel\RdfCommentStorageLoadTest::testRdfCommentStorageLoad()

Tests rdf_comment_storage_load.

File

core/modules/rdf/tests/src/Kernel/RdfCommentStorageLoadTest.php, line 25

Class

RdfCommentStorageLoadTest
Tests rdf_comment_storage_load.

Namespace

Drupal\Tests\rdf\Kernel

Code

public function testRdfCommentStorageLoad() {
  $field_created_item = $this
    ->prophesize(CreatedItem::class);
  $field_created_item
    ->setValue([
    time(),
  ]);
  $field_list = $this
    ->prophesize(FieldItemList::class);
  $field_list
    ->reveal();
  $field_list
    ->first()
    ->willReturn($field_created_item
    ->reveal());
  $comment = $this
    ->prophesize(Comment::class);
  $comment
    ->bundle()
    ->willReturn('page');
  $comment
    ->get('created')
    ->willReturn($field_list);
  $comment
    ->getFieldDefinitions()
    ->willReturn(NULL);

  // Set commented entity and parent entity to NULL.
  $comment
    ->getCommentedEntity()
    ->willReturn(NULL);
  $comment
    ->getParentComment()
    ->willReturn(NULL);

  /** @var \Drupal\Core\Extension\ModuleHandler $module_handler */
  $module_handler = \Drupal::service('module_handler');
  $module_handler
    ->invoke('rdf', 'comment_storage_load', [
    [
      $comment
        ->reveal(),
    ],
  ]);
}