KernelTestBase.php in Video Embed Field 8
File
tests/src/Kernel/KernelTestBase.php
View source
<?php
namespace Drupal\Tests\video_embed_field\Kernel;
use Drupal\Core\Entity\Entity\EntityViewDisplay;
use Drupal\field\Entity\FieldConfig;
use Drupal\field\Entity\FieldStorageConfig;
use Drupal\KernelTests\KernelTestBase as CoreKernelTestBase;
abstract class KernelTestBase extends CoreKernelTestBase {
protected $fieldName = 'field_test';
protected $entityTypeId = 'entity_test';
public static $modules = [
'user',
'system',
'field',
'text',
'entity_test',
'field_test',
'video_embed_field',
'image',
];
protected function setUp() {
parent::setUp();
$this
->installEntitySchema($this->entityTypeId);
$this
->installConfig([
'image',
]);
EntityViewDisplay::create([
'targetEntityType' => 'entity_test',
'bundle' => 'entity_test',
'mode' => 'default',
])
->save();
FieldStorageConfig::create([
'field_name' => $this->fieldName,
'entity_type' => $this->entityTypeId,
'type' => 'video_embed_field',
])
->save();
FieldConfig::create([
'entity_type' => $this->entityTypeId,
'field_name' => $this->fieldName,
'bundle' => $this->entityTypeId,
])
->save();
$this->container
->get('module_handler')
->addModule('colorbox', NULL);
$this->container
->set('http_client', new MockHttpClient());
$colorbox_mock = $this
->getMockBuilder('ColorboxAttachment')
->setMethods([
'attach',
])
->getMock();
$this->container
->set('colorbox.attachment', $colorbox_mock);
}
}