function ItemWithoutFeedTest::testEntityCreation

Same name and namespace in other branches
  1. 9 core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php \Drupal\Tests\aggregator\Kernel\ItemWithoutFeedTest::testEntityCreation()

Tests attempting to create a feed item without a feed.

File

core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php, line 32

Class

ItemWithoutFeedTest
Tests clean handling of an item with a missing feed ID.

Namespace

Drupal\Tests\aggregator\Kernel

Code

public function testEntityCreation() {
    $entity = Item::create([
        'title' => t('Llama 2'),
        'path' => 'https://groups.drupal.org/',
    ]);
    $violations = $entity->validate();
    $this->assertCount(1, $violations);
}

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