Upgraded drupal core with security updates
[yaffs-website] / web / core / modules / aggregator / tests / src / Kernel / ItemWithoutFeedTest.php
1 <?php
2
3 namespace Drupal\Tests\aggregator\Kernel;
4
5 use Drupal\aggregator\Entity\Item;
6 use Drupal\KernelTests\KernelTestBase;
7
8 /**
9  * Tests clean handling of an item with a missing feed ID.
10  *
11  * @group aggregator
12  */
13 class ItemWithoutFeedTest extends KernelTestBase {
14
15   /**
16    * {@inheritdoc}
17    */
18   public static $modules = ['aggregator', 'options'];
19
20   /**
21    * {@inheritdoc}
22    */
23   protected function setUp() {
24     parent::setUp();
25     $this->installEntitySchema('aggregator_feed');
26     $this->installEntitySchema('aggregator_item');
27   }
28
29   /**
30    * Tests attempting to create a feed item without a feed.
31    */
32   public function testEntityCreation() {
33     $entity = Item::create([
34       'title' => t('Llama 2'),
35       'path' => 'https://groups.drupal.org/',
36     ]);
37     $violations = $entity->validate();
38     $this->assertCount(1, $violations);
39   }
40
41 }