InstallTest.php in Lightning Media 8.4
File
modules/lightning_media_image/tests/src/Functional/InstallTest.php
View source
<?php
namespace Drupal\Tests\lightning_media_image\Functional;
use Drupal\Tests\BrowserTestBase;
class InstallTest extends BrowserTestBase {
protected $defaultTheme = 'stark';
protected static $modules = [
'lightning_media_image',
'image_widget_crop',
];
public function test() {
$settings = $this
->config('image_widget_crop.settings')
->get('settings');
$lib = 'libraries/cropper/dist';
$this
->assertStringContainsString("{$lib}/cropper.min.js", $settings['library_url']);
$this
->assertStringContainsString("{$lib}/cropper.min.css", $settings['css_url']);
$form_displays = $this->container
->get('entity_type.manager')
->getStorage('entity_form_display')
->loadByProperties([
'targetEntityType' => 'media',
'bundle' => 'image',
'mode' => [
'default',
'media_browser',
],
]);
foreach ($form_displays as $form_display) {
$component = $form_display
->getComponent('field_media_image');
$this
->assertIsArray($component);
$this
->assertSame('image_widget_crop', $component['type']);
$this
->assertSame([
'freeform',
], $component['settings']['crop_list']);
}
}
}
Classes
Name |
Description |
InstallTest |
Tests install-time logic and configuration of Lightning Media Image. |