function BlockContentRevisionsTest::testNullRevisionUser

Same name in other branches
  1. 11.x core/modules/block_content/tests/src/Kernel/BlockContentRevisionsTest.php \Drupal\Tests\block_content\Kernel\BlockContentRevisionsTest::testNullRevisionUser()

Tests block content revision user id doesn't throw error with null field.

File

core/modules/block_content/tests/src/Kernel/BlockContentRevisionsTest.php, line 40

Class

BlockContentRevisionsTest
Tests revision based functions for Block Content.

Namespace

Drupal\Tests\block_content\Kernel

Code

public function testNullRevisionUser() : void {
    BlockContentType::create([
        'id' => 'basic',
        'label' => 'A basic block type',
    ])->save();
    $block = BlockContent::create([
        'info' => 'Test',
        'type' => 'basic',
        'revision_user' => NULL,
    ]);
    $block->save();
    $this->assertNull($block->getRevisionUserId());
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.