|
1
|
|
|
<?php |
|
2
|
|
|
|
|
3
|
|
|
namespace Drupal\Tests\Driver\Kernel\Drupal8\Entity; |
|
4
|
|
|
|
|
5
|
|
|
use Drupal\KernelTests\Core\Entity\EntityKernelTestBase; |
|
6
|
|
|
use Drupal\Tests\Driver\Kernel\DriverKernelTestTrait; |
|
7
|
|
|
use Drupal\Driver\Plugin\DriverFieldPluginManager; |
|
8
|
|
|
use Drupal\Driver\Plugin\DriverEntityPluginManager; |
|
9
|
|
|
|
|
10
|
|
|
/** |
|
11
|
|
|
* Base class for all Driver entity kernel tests. |
|
12
|
|
|
*/ |
|
13
|
|
|
class DriverEntityKernelTestBase extends EntityKernelTestBase |
|
14
|
|
|
{ |
|
15
|
|
|
|
|
16
|
|
|
use DriverKernelTestTrait; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* Machine name of the entity type being tested. |
|
20
|
|
|
* |
|
21
|
|
|
* @string |
|
22
|
|
|
*/ |
|
23
|
|
|
protected $entityType; |
|
24
|
|
|
|
|
25
|
|
|
/** |
|
26
|
|
|
* Entity storage. |
|
27
|
|
|
* |
|
28
|
|
|
* * @var \Drupal\Core\Entity\EntityStorageInterface; |
|
29
|
|
|
*/ |
|
30
|
|
|
protected $storage; |
|
31
|
|
|
|
|
32
|
|
|
/** |
|
33
|
|
|
* Absolute path to test project plugins. |
|
34
|
|
|
* |
|
35
|
|
|
* * @var string; |
|
36
|
|
|
*/ |
|
37
|
|
|
protected $projectPluginRoot; |
|
38
|
|
|
|
|
39
|
|
|
protected function setUp() |
|
40
|
|
|
{ |
|
41
|
|
|
parent::setUp(); |
|
42
|
|
|
$this->setUpDriver(); |
|
43
|
|
|
if (empty($this->config)) { |
|
44
|
|
|
$this->storage = \Drupal::entityTypeManager() |
|
45
|
|
|
->getStorage($this->entityType); |
|
46
|
|
|
} |
|
47
|
|
|
|
|
48
|
|
|
$namespaces = \Drupal::service('container.namespaces'); |
|
49
|
|
|
$cache_backend = \Drupal::service('cache.discovery'); |
|
50
|
|
|
$module_handler = \Drupal::service('module_handler'); |
|
51
|
|
|
|
|
52
|
|
|
$reflection = new \ReflectionClass($this); |
|
53
|
|
|
$this->projectPluginRoot = dirname($reflection->getFileName(), 7) . "/test_project"; |
|
54
|
|
|
$this->fieldPluginManager = new DriverFieldPluginManager($namespaces, $cache_backend, $module_handler, 8, $this->projectPluginRoot); |
|
55
|
|
|
$this->entityPluginManager = new DriverEntityPluginManager($namespaces, $cache_backend, $module_handler, 8, $this->projectPluginRoot); |
|
56
|
|
|
} |
|
57
|
|
|
} |
|
58
|
|
|
|