Mercurial > hg > isophonics-drupal-site
comparison core/modules/views/tests/src/Kernel/ViewsKernelTestBase.php @ 17:129ea1e6d783
Update, including to Drupal core 8.6.10
author | Chris Cannam |
---|---|
date | Thu, 28 Feb 2019 13:21:36 +0000 |
parents | 4c8ae668cc8c |
children | af1871eacc83 |
comparison
equal
deleted
inserted
replaced
16:c2387f117808 | 17:129ea1e6d783 |
---|---|
5 use Drupal\Core\Database\Database; | 5 use Drupal\Core\Database\Database; |
6 use Drupal\Core\Database\Query\SelectInterface; | 6 use Drupal\Core\Database\Query\SelectInterface; |
7 use Drupal\KernelTests\KernelTestBase; | 7 use Drupal\KernelTests\KernelTestBase; |
8 use Drupal\views\Tests\ViewResultAssertionTrait; | 8 use Drupal\views\Tests\ViewResultAssertionTrait; |
9 use Drupal\views\Tests\ViewTestData; | 9 use Drupal\views\Tests\ViewTestData; |
10 use Drupal\views\ViewsData; | |
10 | 11 |
11 /** | 12 /** |
12 * Defines a base class for Views kernel testing. | 13 * Defines a base class for Views kernel testing. |
13 */ | 14 */ |
14 abstract class ViewsKernelTestBase extends KernelTestBase { | 15 abstract class ViewsKernelTestBase extends KernelTestBase { |
46 | 47 |
47 if ($import_test_views) { | 48 if ($import_test_views) { |
48 ViewTestData::createTestViews(get_class($this), ['views_test_config']); | 49 ViewTestData::createTestViews(get_class($this), ['views_test_config']); |
49 } | 50 } |
50 } | 51 } |
52 | |
51 /** | 53 /** |
52 * Sets up the configuration and schema of views and views_test_data modules. | 54 * Sets up the configuration and schema of views and views_test_data modules. |
53 * | 55 * |
54 * Because the schema of views_test_data.module is dependent on the test | 56 * Because the schema of views_test_data.module is dependent on the test |
55 * using it, it cannot be enabled normally. | 57 * using it, it cannot be enabled normally. |
62 /** @var \Drupal\Core\State\StateInterface $state */ | 64 /** @var \Drupal\Core\State\StateInterface $state */ |
63 $state = $this->container->get('state'); | 65 $state = $this->container->get('state'); |
64 // Define the schema and views data variable before enabling the test module. | 66 // Define the schema and views data variable before enabling the test module. |
65 $state->set('views_test_data_schema', $this->schemaDefinition()); | 67 $state->set('views_test_data_schema', $this->schemaDefinition()); |
66 $state->set('views_test_data_views_data', $this->viewsData()); | 68 $state->set('views_test_data_views_data', $this->viewsData()); |
69 $this->container->get('views.views_data')->clear(); | |
67 | 70 |
68 $this->installConfig(['views', 'views_test_config', 'views_test_data']); | 71 $this->installConfig(['views', 'views_test_config', 'views_test_data']); |
69 foreach ($this->schemaDefinition() as $table => $schema) { | 72 foreach ($this->schemaDefinition() as $table => $schema) { |
70 $this->installSchema('views_test_data', $table); | 73 $this->installSchema('views_test_data', $table); |
71 } | 74 } |