Updated Drupal to 8.6. This goes with the following updates because it's possible...
[yaffs-website] / web / core / modules / datetime_range / tests / src / Kernel / Views / EntityTypeWithoutViewsDataTest.php
1 <?php
2
3 namespace Drupal\Tests\datetime_range\Kernel\Views;
4
5 use Drupal\Core\Config\InstallStorage;
6 use Drupal\Core\Serialization\Yaml;
7 use Drupal\KernelTests\KernelTestBase;
8 use Drupal\views\Entity\View;
9
10 /**
11  * Tests datetime_range.module when an entity type provides no views data.
12  *
13  * @group datetime
14  */
15 class EntityTypeWithoutViewsDataTest extends KernelTestBase {
16
17   /**
18    * {@inheritdoc}
19    */
20   protected static $modules = [
21     'datetime_range',
22     'datetime_range_test',
23     'node',
24     'system',
25     'taxonomy',
26     'text',
27     'user',
28     'views',
29   ];
30
31   /**
32    * Tests the case when an entity type provides no views data.
33    *
34    * @see datetime_test_entity_type_alter()
35    * @see datetime_range_view_presave()
36    */
37   public function testEntityTypeWithoutViewsData() {
38     $view_yaml = drupal_get_path('module', 'taxonomy') . '/' . InstallStorage::CONFIG_OPTIONAL_DIRECTORY . '/views.view.taxonomy_term.yml';
39     $values = Yaml::decode(file_get_contents($view_yaml));
40     $this->assertEquals(SAVED_NEW, View::create($values)->save());
41   }
42
43 }