class ItemWithoutFeedTest

Same name and namespace in other branches
  1. 8.9.x core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php \Drupal\Tests\aggregator\Kernel\ItemWithoutFeedTest

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

@group aggregator @group legacy

Hierarchy

Expanded class hierarchy of ItemWithoutFeedTest

File

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

Namespace

Drupal\Tests\aggregator\Kernel
View source
class ItemWithoutFeedTest extends KernelTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected static $modules = [
    'aggregator',
    'options',
  ];
  
  /**
   * {@inheritdoc}
   */
  protected function setUp() : void {
    parent::setUp();
    $this->installEntitySchema('aggregator_feed');
    $this->installEntitySchema('aggregator_item');
  }
  
  /**
   * Tests attempting to create a feed item without a feed.
   */
  public function testEntityCreation() {
    $entity = Item::create([
      'title' => '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.