3 namespace Drupal\Tests\video_embed_field\Kernel;
5 use Drupal\Core\Entity\Entity\EntityViewDisplay;
6 use Drupal\field\Entity\FieldConfig;
7 use Drupal\field\Entity\FieldStorageConfig;
8 use Drupal\KernelTests\KernelTestBase as CoreKernelTestBase;
13 abstract class KernelTestBase extends CoreKernelTestBase {
16 * The test field name.
20 protected $fieldName = 'field_test';
27 protected $entityTypeId = 'entity_test';
34 public static $modules = [
48 protected function setUp() {
51 $this->installEntitySchema($this->entityTypeId);
53 // Install image styles.
54 $this->installConfig(['image']);
56 EntityViewDisplay::create([
57 'targetEntityType' => 'entity_test',
58 'bundle' => 'entity_test',
61 FieldStorageConfig::create([
62 'field_name' => $this->fieldName,
63 'entity_type' => $this->entityTypeId,
64 'type' => 'video_embed_field',
67 'entity_type' => $this->entityTypeId,
68 'field_name' => $this->fieldName,
69 'bundle' => $this->entityTypeId,
72 // Fake colorbox being enabled for the purposes of testing.
73 $this->container->get('module_handler')->addModule('colorbox', NULL);
75 // Use a HTTP mock which won't attempt to download anything.
76 $this->container->set('http_client', new MockHttpClient());
78 // Shim in a service required from the colorbox module.
79 $colorbox_mock = $this->getMockBuilder('ColorboxAttachment')->setMethods(['attach'])->getMock();
80 $this->container->set('colorbox.attachment', $colorbox_mock);