You are here

public function ItemWithoutFeedTest::testEntityCreation in Zircon Profile 8

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

Tests attempting to create a feed item without a feed.

File

core/modules/aggregator/src/Tests/ItemWithoutFeedTest.php, line 37
Contains \Drupal\aggregator\Tests\ItemWithoutFeedTest.

Class

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

Namespace

Drupal\aggregator\Tests

Code

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