BlockContentRevisionsTest.php

Same filename in this branch
  1. 10 core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php
Same filename and directory in other branches
  1. 9 core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php
  2. 8.9.x core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php
  3. 11.x core/modules/block_content/tests/src/Kernel/BlockContentRevisionsTest.php
  4. 11.x core/modules/block_content/tests/src/Functional/BlockContentRevisionsTest.php

Namespace

Drupal\Tests\block_content\Kernel

File

core/modules/block_content/tests/src/Kernel/BlockContentRevisionsTest.php

View source
<?php

declare (strict_types=1);
namespace Drupal\Tests\block_content\Kernel;

use Drupal\block_content\Entity\BlockContent;
use Drupal\KernelTests\KernelTestBase;
use Drupal\block_content\Entity\BlockContentType;

/**
 * Tests revision based functions for Block Content.
 *
 * @group block_content
 */
class BlockContentRevisionsTest extends KernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'block',
        'block_content',
        'system',
        'user',
    ];
    
    /**
     * {@inheritdoc}
     */
    public function setUp() : void {
        parent::setUp();
        $this->installEntitySchema('user');
        $this->installEntitySchema('block_content');
    }
    
    /**
     * Tests block content revision user id doesn't throw error with null field.
     */
    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());
    }

}

Classes

Title Deprecated Summary
BlockContentRevisionsTest Tests revision based functions for Block Content.

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