374a38e89a962a828c7f9b2df9414701bccae918
[yaffs-website] / web / core / modules / aggregator / src / Tests / Update / AggregatorUpdateTest.php
1 <?php
2
3 namespace Drupal\aggregator\Tests\Update;
4
5 use Drupal\system\Tests\Update\UpdatePathTestBase;
6
7 /**
8  * Tests that node settings are properly updated during database updates.
9  *
10  * @group aggregator
11  */
12 class AggregatorUpdateTest extends UpdatePathTestBase {
13
14   /**
15    * {@inheritdoc}
16    */
17   protected function setDatabaseDumpFiles() {
18     $this->databaseDumpFiles = [
19       __DIR__ . '/../../../../system/tests/fixtures/update/drupal-8.filled.standard.php.gz',
20     ];
21   }
22
23   /**
24    * Tests that the 'Source feed' field is required.
25    *
26    * @see aggregator_update_8200()
27    */
28   public function testSourceFeedRequired() {
29     // Check that the 'fid' field is not required prior to the update.
30     $field_definition = \Drupal::entityDefinitionUpdateManager()->getFieldStorageDefinition('fid', 'aggregator_item');
31     $this->assertFalse($field_definition->isRequired());
32
33     // Run updates.
34     $this->runUpdates();
35
36     // Check that the 'fid' field is now required.
37     $field_definition = \Drupal::entityDefinitionUpdateManager()->getFieldStorageDefinition('fid', 'aggregator_item');
38     $this->assertTrue($field_definition->isRequired());
39   }
40
41 }