ItemWithoutFeedTest.php in Drupal 8
File
core/modules/aggregator/tests/src/Kernel/ItemWithoutFeedTest.php
View source
<?php
namespace Drupal\Tests\aggregator\Kernel;
use Drupal\aggregator\Entity\Item;
use Drupal\KernelTests\KernelTestBase;
class ItemWithoutFeedTest extends KernelTestBase {
public static $modules = [
'aggregator',
'options',
];
protected function setUp() {
parent::setUp();
$this
->installEntitySchema('aggregator_feed');
$this
->installEntitySchema('aggregator_item');
}
public function testEntityCreation() {
$entity = Item::create([
'title' => t('Llama 2'),
'path' => 'https://groups.drupal.org/',
]);
$violations = $entity
->validate();
$this
->assertCount(1, $violations);
}
}