| @@ -10,65 +10,65 @@ discard block | ||
| 10 | 10 | * @group media | 
| 11 | 11 | */ | 
| 12 | 12 |  class VideoBundleTest extends WebTestBase { | 
| 13 | - /** | |
| 14 | - * Exempt from strict schema checking. | |
| 15 | - * | |
| 16 | - * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | - * | |
| 18 | - * @var bool | |
| 19 | - */ | |
| 20 | - protected $strictConfigSchema = FALSE; | |
| 13 | + /** | |
| 14 | + * Exempt from strict schema checking. | |
| 15 | + * | |
| 16 | + * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | + * | |
| 18 | + * @var bool | |
| 19 | + */ | |
| 20 | + protected $strictConfigSchema = FALSE; | |
| 21 | 21 | |
| 22 | - /** | |
| 23 | - * Modules to enable. | |
| 24 | - * | |
| 25 | - * @var array | |
| 26 | - */ | |
| 27 | - public static $modules = [ | |
| 22 | + /** | |
| 23 | + * Modules to enable. | |
| 24 | + * | |
| 25 | + * @var array | |
| 26 | + */ | |
| 27 | + public static $modules = [ | |
| 28 | 28 | 'media', | 
| 29 | 29 | 'media_entity', | 
| 30 | 30 | 'video_embed_field', | 
| 31 | 31 | 'video_embed_media', | 
| 32 | 32 | 'node', | 
| 33 | - ]; | |
| 33 | + ]; | |
| 34 | 34 | |
| 35 | - /** | |
| 36 | - * The test media bundle. | |
| 37 | - * | |
| 38 | - * @var \Drupal\media_entity\MediaBundleInterface | |
| 39 | - */ | |
| 40 | - protected $testBundle; | |
| 35 | + /** | |
| 36 | + * The test media bundle. | |
| 37 | + * | |
| 38 | + * @var \Drupal\media_entity\MediaBundleInterface | |
| 39 | + */ | |
| 40 | + protected $testBundle; | |
| 41 | 41 | |
| 42 | - /** | |
| 43 | -   * {@inheritdoc} | |
| 44 | - */ | |
| 45 | -  protected function setUp() { | |
| 42 | + /** | |
| 43 | +     * {@inheritdoc} | |
| 44 | + */ | |
| 45 | +    protected function setUp() { | |
| 46 | 46 | parent::setUp(); | 
| 47 | 47 |      $this->testBundle = $this->container->get('entity.manager')->getStorage('media_bundle')->load('video'); | 
| 48 | 48 | |
| 49 | 49 | $adminUser = $this->drupalCreateUser([ | 
| 50 | - 'view media', | |
| 51 | - 'create media', | |
| 52 | - 'update media', | |
| 53 | - 'update any media', | |
| 54 | - 'delete media', | |
| 55 | - 'delete any media', | |
| 56 | - 'access media overview', | |
| 50 | + 'view media', | |
| 51 | + 'create media', | |
| 52 | + 'update media', | |
| 53 | + 'update any media', | |
| 54 | + 'delete media', | |
| 55 | + 'delete any media', | |
| 56 | + 'access media overview', | |
| 57 | 57 | ]); | 
| 58 | 58 | $this->drupalLogin($adminUser); | 
| 59 | - } | |
| 59 | + } | |
| 60 | 60 | |
| 61 | - /** | |
| 62 | - * Tests video media bundle creation from config files. | |
| 63 | - */ | |
| 64 | -  public function testMediaBundleCreationFromModule() { | |
| 61 | + /** | |
| 62 | + * Tests video media bundle creation from config files. | |
| 63 | + */ | |
| 64 | +    public function testMediaBundleCreationFromModule() { | |
| 65 | 65 | $type_configuration = [ | 
| 66 | - 'source_field' => 'field_video', | |
| 66 | + 'source_field' => 'field_video', | |
| 67 | 67 | ]; | 
| 68 | 68 | |
| 69 | 69 | $field_map = [ | 
| 70 | - 'id' => 'field_id', | |
| 71 | - 'source_name' => 'field_source', | |
| 70 | + 'id' => 'field_id', | |
| 71 | + 'source_name' => 'field_source', | |
| 72 | 72 | ]; | 
| 73 | 73 | |
| 74 | 74 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); | 
| @@ -77,15 +77,15 @@ discard block | ||
| 77 | 77 |      $this->assertEqual($this->testBundle->get('type'), 'video_embed_field', 'Correct plugin ID detected.'); | 
| 78 | 78 |      $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.'); | 
| 79 | 79 |      $this->assertEqual($this->testBundle->get('field_map'), $field_map, 'Correct field map detected.'); | 
| 80 | - } | |
| 80 | + } | |
| 81 | 81 | |
| 82 | - /** | |
| 83 | - * Tests video media bundle field maps. | |
| 84 | - */ | |
| 85 | -  public function testBundleFieldMap() { | |
| 82 | + /** | |
| 83 | + * Tests video media bundle field maps. | |
| 84 | + */ | |
| 85 | +    public function testBundleFieldMap() { | |
| 86 | 86 | $edit = [ | 
| 87 | - 'name[0][value]' => 'Drupal video!', | |
| 88 | - 'field_video[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ', | |
| 87 | + 'name[0][value]' => 'Drupal video!', | |
| 88 | + 'field_video[0][value]' => 'https://www.youtube.com/watch?v=XgYu7-DQjDQ', | |
| 89 | 89 | ]; | 
| 90 | 90 |      $this->drupalPostForm('media/add/' . $this->testBundle->id(), $edit, t('Save and publish')); | 
| 91 | 91 | |
| @@ -94,11 +94,11 @@ discard block | ||
| 94 | 94 | $media_id = reset($media_id); | 
| 95 | 95 | /** @var \Drupal\media_entity\MediaInterface $media */ | 
| 96 | 96 |      $media = $this->container->get('entity_type.manager') | 
| 97 | -      ->getStorage('media') | |
| 98 | - ->loadUnchanged($media_id); | |
| 97 | +        ->getStorage('media') | |
| 98 | + ->loadUnchanged($media_id); | |
| 99 | 99 | $properties = $media->toArray(); | 
| 100 | 100 | $this->assertEqual($properties['field_id'][0]['value'], 'XgYu7-DQjDQ', 'Correct video ID detected.'); | 
| 101 | 101 | $this->assertEqual($properties['field_source'][0]['value'], 'youtube', 'Correct video source detected.'); | 
| 102 | - } | |
| 102 | + } | |
| 103 | 103 | |
| 104 | 104 | } | 
| @@ -10,61 +10,61 @@ discard block | ||
| 10 | 10 | * @group media | 
| 11 | 11 | */ | 
| 12 | 12 |  class ImageBundleTest extends WebTestBase { | 
| 13 | - /** | |
| 14 | - * Exempt from strict schema checking. | |
| 15 | - * | |
| 16 | - * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | - * | |
| 18 | - * @var bool | |
| 19 | - */ | |
| 20 | - protected $strictConfigSchema = FALSE; | |
| 13 | + /** | |
| 14 | + * Exempt from strict schema checking. | |
| 15 | + * | |
| 16 | + * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | + * | |
| 18 | + * @var bool | |
| 19 | + */ | |
| 20 | + protected $strictConfigSchema = FALSE; | |
| 21 | 21 | |
| 22 | - /** | |
| 23 | - * Modules to enable. | |
| 24 | - * | |
| 25 | - * @var array | |
| 26 | - */ | |
| 27 | - public static $modules = [ | |
| 22 | + /** | |
| 23 | + * Modules to enable. | |
| 24 | + * | |
| 25 | + * @var array | |
| 26 | + */ | |
| 27 | + public static $modules = [ | |
| 28 | 28 | 'media', | 
| 29 | 29 | 'media_entity', | 
| 30 | 30 | 'media_entity_image', | 
| 31 | 31 | 'image', | 
| 32 | 32 | 'node', | 
| 33 | - ]; | |
| 33 | + ]; | |
| 34 | 34 | |
| 35 | - /** | |
| 36 | - * The test media bundle. | |
| 37 | - * | |
| 38 | - * @var \Drupal\media_entity\MediaBundleInterface | |
| 39 | - */ | |
| 40 | - protected $testBundle; | |
| 35 | + /** | |
| 36 | + * The test media bundle. | |
| 37 | + * | |
| 38 | + * @var \Drupal\media_entity\MediaBundleInterface | |
| 39 | + */ | |
| 40 | + protected $testBundle; | |
| 41 | 41 | |
| 42 | - /** | |
| 43 | -   * {@inheritdoc} | |
| 44 | - */ | |
| 45 | -  protected function setUp() { | |
| 42 | + /** | |
| 43 | +     * {@inheritdoc} | |
| 44 | + */ | |
| 45 | +    protected function setUp() { | |
| 46 | 46 | parent::setUp(); | 
| 47 | 47 |      $this->testBundle = $this->container->get('entity.manager')->getStorage('media_bundle')->load('image'); | 
| 48 | 48 | |
| 49 | 49 | $adminUser = $this->drupalCreateUser([ | 
| 50 | - 'view media', | |
| 51 | - 'create media', | |
| 52 | - 'update media', | |
| 53 | - 'update any media', | |
| 54 | - 'delete media', | |
| 55 | - 'delete any media', | |
| 56 | - 'access media overview', | |
| 50 | + 'view media', | |
| 51 | + 'create media', | |
| 52 | + 'update media', | |
| 53 | + 'update any media', | |
| 54 | + 'delete media', | |
| 55 | + 'delete any media', | |
| 56 | + 'access media overview', | |
| 57 | 57 | ]); | 
| 58 | 58 | $this->drupalLogin($adminUser); | 
| 59 | - } | |
| 59 | + } | |
| 60 | 60 | |
| 61 | - /** | |
| 62 | - * Tests image media bundle creation from config files. | |
| 63 | - */ | |
| 64 | -  public function testMediaBundleCreationFromModule() { | |
| 61 | + /** | |
| 62 | + * Tests image media bundle creation from config files. | |
| 63 | + */ | |
| 64 | +    public function testMediaBundleCreationFromModule() { | |
| 65 | 65 | $type_configuration = [ | 
| 66 | - 'source_field' => 'field_image', | |
| 67 | - 'gather_exif' => FALSE, | |
| 66 | + 'source_field' => 'field_image', | |
| 67 | + 'gather_exif' => FALSE, | |
| 68 | 68 | ]; | 
| 69 | 69 | |
| 70 | 70 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); | 
| @@ -73,20 +73,20 @@ discard block | ||
| 73 | 73 |      $this->assertEqual($this->testBundle->get('type'), 'image', 'Correct plugin ID detected.'); | 
| 74 | 74 |      $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.'); | 
| 75 | 75 |      $this->assertEqual($this->testBundle->get('field_map'), [], 'Correct field map detected.'); | 
| 76 | - } | |
| 76 | + } | |
| 77 | 77 | |
| 78 | - /** | |
| 79 | - * Tests item creation and thumbnail. | |
| 80 | - */ | |
| 81 | -  public function testMediaBundleItemCreation() { | |
| 78 | + /** | |
| 79 | + * Tests item creation and thumbnail. | |
| 80 | + */ | |
| 81 | +    public function testMediaBundleItemCreation() { | |
| 82 | 82 | // Define the media item name. | 
| 83 | 83 | $name = $this->randomMachineName(); | 
| 84 | 84 |      $image_files = $this->drupalGetTestFiles('image'); | 
| 85 | 85 | $testImage = current($image_files); | 
| 86 | 86 |      $file_path = $this->container->get('file_system')->realpath($testImage->uri); | 
| 87 | 87 | $edit = [ | 
| 88 | - 'name[0][value]' => $name, | |
| 89 | - 'files[field_image_0]' => $file_path, | |
| 88 | + 'name[0][value]' => $name, | |
| 89 | + 'files[field_image_0]' => $file_path, | |
| 90 | 90 | ]; | 
| 91 | 91 | |
| 92 | 92 | // Save the image. | 
| @@ -105,6 +105,6 @@ discard block | ||
| 105 | 105 | $thumbnail = $image->thumbnail($media); | 
| 106 | 106 | $default_thumbnail = $image->getDefaultThumbnail(); | 
| 107 | 107 | $this->assertNotEqual($thumbnail, $default_thumbnail, "The thumbnail generated is different from the default thumbnail."); | 
| 108 | - } | |
| 108 | + } | |
| 109 | 109 | |
| 110 | 110 | } | 
| @@ -27,7 +27,7 @@ | ||
| 27 | 27 | /** | 
| 28 | 28 | * Implements hook_form_alter(). | 
| 29 | 29 | */ | 
| 30 | -function media_form_alter(&$form, FormStateInterface &$form_state) { | |
| 30 | +function media_form_alter(&$form, FormStateInterface & $form_state) { | |
| 31 | 31 |    if (isset($form['#form_id'])) { | 
| 32 | 32 |      if ($form['#form_id'] == 'entity_browser_media_library_form') { | 
| 33 | 33 | // Attach our library. | 
| @@ -13,13 +13,13 @@ discard block | ||
| 13 | 13 | * Implements hook_help(). | 
| 14 | 14 | */ | 
| 15 | 15 |  function media_help($route_name, RouteMatchInterface $route_match) { | 
| 16 | -  switch ($route_name) { | |
| 16 | +    switch ($route_name) { | |
| 17 | 17 | // Main module help for the media module. | 
| 18 | 18 | case 'help.page.media': | 
| 19 | 19 | $output = ''; | 
| 20 | -      $output .= '<h3>' . t('About') . '</h3>'; | |
| 21 | -      $output .= '<p>' . t('Media module for Drupal 8') . '</p>'; | |
| 22 | - return $output; | |
| 20 | +        $output .= '<h3>' . t('About') . '</h3>'; | |
| 21 | +        $output .= '<p>' . t('Media module for Drupal 8') . '</p>'; | |
| 22 | + return $output; | |
| 23 | 23 | |
| 24 | 24 | default: | 
| 25 | 25 | } | 
| @@ -29,29 +29,29 @@ discard block | ||
| 29 | 29 | * Implements hook_form_alter(). | 
| 30 | 30 | */ | 
| 31 | 31 |  function media_form_alter(&$form, FormStateInterface &$form_state) { | 
| 32 | -  if ($form['#form_id'] == 'entity_browser_media_library_form') { | |
| 32 | +    if ($form['#form_id'] == 'entity_browser_media_library_form') { | |
| 33 | 33 | // Style the submit button. | 
| 34 | 34 | $form['actions']['submit']['#attributes']['class'][] = 'button--primary'; | 
| 35 | 35 | $form['actions']['submit']['#attributes']['class'][] = 'entity-browser-modal-target'; | 
| 36 | - } | |
| 37 | - // Remove the Gallery option from create gallery view's bundle filters. | |
| 38 | -  if ($form['#id'] == 'views-exposed-form-media-library-gallery-media-select-modal' || $form['#id'] == 'views-exposed-form-media-library-gallery-user-media-select-modal') { | |
| 36 | + } | |
| 37 | + // Remove the Gallery option from create gallery view's bundle filters. | |
| 38 | +    if ($form['#id'] == 'views-exposed-form-media-library-gallery-media-select-modal' || $form['#id'] == 'views-exposed-form-media-library-gallery-user-media-select-modal') { | |
| 39 | 39 | unset($form['bundle_1']['#options']['gallery']); | 
| 40 | - } | |
| 40 | + } | |
| 41 | 41 | } | 
| 42 | 42 | |
| 43 | 43 | /** | 
| 44 | 44 | * Implements hook_library_info_alter(). | 
| 45 | 45 | */ | 
| 46 | 46 |  function media_library_info_alter(&$libraries, $extension) { | 
| 47 | - // Optionally use the Libraries module to determine our library paths. | |
| 48 | -  if ($extension == 'media' && \Drupal::moduleHandler()->moduleExists('libraries')) { | |
| 47 | + // Optionally use the Libraries module to determine our library paths. | |
| 48 | +    if ($extension == 'media' && \Drupal::moduleHandler()->moduleExists('libraries')) { | |
| 49 | 49 |      $imagesloaded_path = libraries_get_path('imagesloaded') . '/imagesloaded.pkgd.min.js'; | 
| 50 | 50 |      $masonry_path = libraries_get_path('masonry') . '/dist/masonry.pkgd.min.js'; | 
| 51 | 51 | |
| 52 | 52 | $libraries['imagesloaded']['js'] = ['/' . $imagesloaded_path => ['minified' => 'true']]; | 
| 53 | 53 | $libraries['masonry']['js'] = ['/' . $masonry_path => ['minified' => 'true']]; | 
| 54 | - } | |
| 54 | + } | |
| 55 | 55 | } | 
| 56 | 56 | |
| 57 | 57 | /** | 
| @@ -60,9 +60,9 @@ discard block | ||
| 60 | 60 | * Adds the media.view library to the media views. | 
| 61 | 61 | */ | 
| 62 | 62 |  function media_views_pre_render(ViewExecutable $view) { | 
| 63 | -  if (isset($view) && ($view->storage->id() == 'media_library' || $view->storage->id() == 'global_media_library')) { | |
| 63 | +    if (isset($view) && ($view->storage->id() == 'media_library' || $view->storage->id() == 'global_media_library')) { | |
| 64 | 64 | $view->element['#attached']['library'][] = 'media/view'; | 
| 65 | - } | |
| 65 | + } | |
| 66 | 66 | } | 
| 67 | 67 | |
| 68 | 68 | /** | 
| @@ -71,14 +71,14 @@ discard block | ||
| 71 | 71 | * Adds the add media button from media_entity on library pages. | 
| 72 | 72 | */ | 
| 73 | 73 |  function media_menu_local_actions_alter(&$local_actions) { | 
| 74 | - $local_actions['media.add']['appears_on'][] = 'view.media_library.user_media_library'; | |
| 75 | - $local_actions['media.add']['appears_on'][] = 'view.media_library.global_media_library_page'; | |
| 74 | + $local_actions['media.add']['appears_on'][] = 'view.media_library.user_media_library'; | |
| 75 | + $local_actions['media.add']['appears_on'][] = 'view.media_library.global_media_library_page'; | |
| 76 | 76 | } | 
| 77 | 77 | |
| 78 | 78 | /** | 
| 79 | 79 | * Implements hook_entity_type_alter(). | 
| 80 | 80 | */ | 
| 81 | 81 |  function media_entity_type_alter(array &$entity_types) { | 
| 82 | -  $field_name = \Drupal::config('media_entity.bundle.gallery')->get('type_configuration.source_field'); | |
| 83 | -  $entity_types['media']->addConstraint('GalleryMediaBundle', array('sourceFieldName' => $field_name)); | |
| 82 | +    $field_name = \Drupal::config('media_entity.bundle.gallery')->get('type_configuration.source_field'); | |
| 83 | +    $entity_types['media']->addConstraint('GalleryMediaBundle', array('sourceFieldName' => $field_name)); | |
| 84 | 84 | } | 
| @@ -10,22 +10,22 @@ | ||
| 10 | 10 | */ | 
| 11 | 11 |  class GalleryMediaBundleConstraintValidator extends ConstraintValidator { | 
| 12 | 12 | |
| 13 | - /** | |
| 14 | -   * {@inheritdoc} | |
| 15 | - */ | |
| 16 | -  public function validate($value, Constraint $constraint) { | |
| 13 | + /** | |
| 14 | +     * {@inheritdoc} | |
| 15 | + */ | |
| 16 | +    public function validate($value, Constraint $constraint) { | |
| 17 | 17 |      if (!isset($value)) { | 
| 18 | - return; | |
| 18 | + return; | |
| 19 | 19 | } | 
| 20 | 20 |      if ($value->hasField($constraint->sourceFieldName)) { | 
| 21 | - $slideshowItems = $value->get($constraint->sourceFieldName); | |
| 22 | -      foreach ($slideshowItems as $item) { | |
| 21 | + $slideshowItems = $value->get($constraint->sourceFieldName); | |
| 22 | +        foreach ($slideshowItems as $item) { | |
| 23 | 23 |          $itemBundle = \Drupal::entityTypeManager()->getStorage('media')->load($item->target_id)->bundle(); | 
| 24 | 24 |          if ($itemBundle == "gallery") { | 
| 25 | - $this->context->addViolation($constraint->message); | |
| 25 | + $this->context->addViolation($constraint->message); | |
| 26 | 26 | } | 
| 27 | - } | |
| 27 | + } | |
| 28 | + } | |
| 28 | 29 | } | 
| 29 | - } | |
| 30 | 30 | |
| 31 | 31 | } | 
| @@ -14,17 +14,17 @@ | ||
| 14 | 14 | */ | 
| 15 | 15 |  class GalleryMediaBundleConstraint extends Constraint { | 
| 16 | 16 | |
| 17 | - /** | |
| 18 | - * Name of the source field for slideshow bundle. | |
| 19 | - * | |
| 20 | - * @var string | |
| 21 | - */ | |
| 22 | - public $sourceFieldName; | |
| 17 | + /** | |
| 18 | + * Name of the source field for slideshow bundle. | |
| 19 | + * | |
| 20 | + * @var string | |
| 21 | + */ | |
| 22 | + public $sourceFieldName; | |
| 23 | 23 | |
| 24 | - /** | |
| 25 | - * The default violation message. | |
| 26 | - * | |
| 27 | - * @var string | |
| 28 | - */ | |
| 29 | - public $message = 'Gallery cannot contain gallery type item.'; | |
| 24 | + /** | |
| 25 | + * The default violation message. | |
| 26 | + * | |
| 27 | + * @var string | |
| 28 | + */ | |
| 29 | + public $message = 'Gallery cannot contain gallery type item.'; | |
| 30 | 30 | } | 
| @@ -10,65 +10,65 @@ discard block | ||
| 10 | 10 | * @group media | 
| 11 | 11 | */ | 
| 12 | 12 |  class InstagramBundleTest extends WebTestBase { | 
| 13 | - /** | |
| 14 | - * Exempt from strict schema checking. | |
| 15 | - * | |
| 16 | - * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | - * | |
| 18 | - * @var bool | |
| 19 | - */ | |
| 20 | - protected $strictConfigSchema = FALSE; | |
| 13 | + /** | |
| 14 | + * Exempt from strict schema checking. | |
| 15 | + * | |
| 16 | + * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | + * | |
| 18 | + * @var bool | |
| 19 | + */ | |
| 20 | + protected $strictConfigSchema = FALSE; | |
| 21 | 21 | |
| 22 | - /** | |
| 23 | - * Modules to enable. | |
| 24 | - * | |
| 25 | - * @var array | |
| 26 | - */ | |
| 27 | - public static $modules = [ | |
| 22 | + /** | |
| 23 | + * Modules to enable. | |
| 24 | + * | |
| 25 | + * @var array | |
| 26 | + */ | |
| 27 | + public static $modules = [ | |
| 28 | 28 | 'media', | 
| 29 | 29 | 'media_entity', | 
| 30 | 30 | 'media_entity_instagram', | 
| 31 | 31 | 'link', | 
| 32 | 32 | 'node', | 
| 33 | - ]; | |
| 33 | + ]; | |
| 34 | 34 | |
| 35 | - /** | |
| 36 | - * The test media bundle. | |
| 37 | - * | |
| 38 | - * @var \Drupal\media_entity\MediaBundleInterface | |
| 39 | - */ | |
| 40 | - protected $testBundle; | |
| 35 | + /** | |
| 36 | + * The test media bundle. | |
| 37 | + * | |
| 38 | + * @var \Drupal\media_entity\MediaBundleInterface | |
| 39 | + */ | |
| 40 | + protected $testBundle; | |
| 41 | 41 | |
| 42 | - /** | |
| 43 | -   * {@inheritdoc} | |
| 44 | - */ | |
| 45 | -  protected function setUp() { | |
| 42 | + /** | |
| 43 | +     * {@inheritdoc} | |
| 44 | + */ | |
| 45 | +    protected function setUp() { | |
| 46 | 46 | parent::setUp(); | 
| 47 | 47 |      $this->testBundle = $this->container->get('entity.manager')->getStorage('media_bundle')->load('instagram'); | 
| 48 | 48 | |
| 49 | 49 | $adminUser = $this->drupalCreateUser([ | 
| 50 | - 'view media', | |
| 51 | - 'create media', | |
| 52 | - 'update media', | |
| 53 | - 'update any media', | |
| 54 | - 'delete media', | |
| 55 | - 'delete any media', | |
| 56 | - 'access media overview', | |
| 50 | + 'view media', | |
| 51 | + 'create media', | |
| 52 | + 'update media', | |
| 53 | + 'update any media', | |
| 54 | + 'delete media', | |
| 55 | + 'delete any media', | |
| 56 | + 'access media overview', | |
| 57 | 57 | ]); | 
| 58 | 58 | $this->drupalLogin($adminUser); | 
| 59 | - } | |
| 59 | + } | |
| 60 | 60 | |
| 61 | - /** | |
| 62 | - * Tests instagram media bundle creation from config files. | |
| 63 | - */ | |
| 64 | -  public function testMediaBundleCreationFromModule() { | |
| 61 | + /** | |
| 62 | + * Tests instagram media bundle creation from config files. | |
| 63 | + */ | |
| 64 | +    public function testMediaBundleCreationFromModule() { | |
| 65 | 65 | $type_configuration = [ | 
| 66 | - 'use_instagram_api' => FALSE, | |
| 67 | - 'source_field' => 'field_instagram_url', | |
| 68 | - 'client_id' => '', | |
| 66 | + 'use_instagram_api' => FALSE, | |
| 67 | + 'source_field' => 'field_instagram_url', | |
| 68 | + 'client_id' => '', | |
| 69 | 69 | ]; | 
| 70 | 70 | $field_map = [ | 
| 71 | - 'shortcode' => 'field_instagram_shortcode', | |
| 71 | + 'shortcode' => 'field_instagram_shortcode', | |
| 72 | 72 | ]; | 
| 73 | 73 | |
| 74 | 74 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); | 
| @@ -77,18 +77,18 @@ discard block | ||
| 77 | 77 |      $this->assertEqual($this->testBundle->get('type'), 'instagram', 'Correct plugin ID detected.'); | 
| 78 | 78 |      $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.'); | 
| 79 | 79 |      $this->assertEqual($this->testBundle->get('field_map'), $field_map, 'Correct field map detected.'); | 
| 80 | - } | |
| 80 | + } | |
| 81 | 81 | |
| 82 | - /** | |
| 83 | - * Tests item creation and thumbnail. | |
| 84 | - */ | |
| 85 | -  public function testMediaBundleItemCreation() { | |
| 82 | + /** | |
| 83 | + * Tests item creation and thumbnail. | |
| 84 | + */ | |
| 85 | +    public function testMediaBundleItemCreation() { | |
| 86 | 86 | // Define the media item name. | 
| 87 | 87 | $name = $this->randomMachineName(); | 
| 88 | 88 | $instagram_url = 'https://www.instagram.com/p/C/'; | 
| 89 | 89 | $edit = [ | 
| 90 | - 'name[0][value]' => $name, | |
| 91 | - 'field_instagram_url[0][uri]' => $instagram_url, | |
| 90 | + 'name[0][value]' => $name, | |
| 91 | + 'field_instagram_url[0][uri]' => $instagram_url, | |
| 92 | 92 | ]; | 
| 93 | 93 | |
| 94 | 94 | // Save the Instagram post. | 
| @@ -102,10 +102,10 @@ discard block | ||
| 102 | 102 | $media_id = reset($media_id); | 
| 103 | 103 | /** @var \Drupal\media_entity\MediaInterface $media */ | 
| 104 | 104 |      $media = $this->container->get('entity_type.manager') | 
| 105 | -      ->getStorage('media') | |
| 106 | - ->loadUnchanged($media_id); | |
| 105 | +        ->getStorage('media') | |
| 106 | + ->loadUnchanged($media_id); | |
| 107 | 107 | $properties = $media->toArray(); | 
| 108 | 108 |      $this->assertEqual($media->get('field_instagram_shortcode')[0]->getValue()['value'], "C", "Correct shortcode stored."); | 
| 109 | - } | |
| 109 | + } | |
| 110 | 110 | |
| 111 | 111 | } | 
| @@ -10,63 +10,63 @@ discard block | ||
| 10 | 10 | * @group media | 
| 11 | 11 | */ | 
| 12 | 12 |  class DocumentBundleTest extends WebTestBase { | 
| 13 | - /** | |
| 14 | - * Exempt from strict schema checking. | |
| 15 | - * | |
| 16 | - * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | - * | |
| 18 | - * @var bool | |
| 19 | - */ | |
| 20 | - protected $strictConfigSchema = FALSE; | |
| 13 | + /** | |
| 14 | + * Exempt from strict schema checking. | |
| 15 | + * | |
| 16 | + * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | + * | |
| 18 | + * @var bool | |
| 19 | + */ | |
| 20 | + protected $strictConfigSchema = FALSE; | |
| 21 | 21 | |
| 22 | - /** | |
| 23 | - * Modules to enable. | |
| 24 | - * | |
| 25 | - * @var array | |
| 26 | - */ | |
| 27 | - public static $modules = [ | |
| 22 | + /** | |
| 23 | + * Modules to enable. | |
| 24 | + * | |
| 25 | + * @var array | |
| 26 | + */ | |
| 27 | + public static $modules = [ | |
| 28 | 28 | 'media', | 
| 29 | 29 | 'media_entity', | 
| 30 | 30 | 'media_entity_document', | 
| 31 | 31 | 'node', | 
| 32 | - ]; | |
| 32 | + ]; | |
| 33 | 33 | |
| 34 | - /** | |
| 35 | - * The test media bundle. | |
| 36 | - * | |
| 37 | - * @var \Drupal\media_entity\MediaBundleInterface | |
| 38 | - */ | |
| 39 | - protected $testBundle; | |
| 34 | + /** | |
| 35 | + * The test media bundle. | |
| 36 | + * | |
| 37 | + * @var \Drupal\media_entity\MediaBundleInterface | |
| 38 | + */ | |
| 39 | + protected $testBundle; | |
| 40 | 40 | |
| 41 | - /** | |
| 42 | -   * {@inheritdoc} | |
| 43 | - */ | |
| 44 | -  protected function setUp() { | |
| 41 | + /** | |
| 42 | +     * {@inheritdoc} | |
| 43 | + */ | |
| 44 | +    protected function setUp() { | |
| 45 | 45 | parent::setUp(); | 
| 46 | 46 |      $this->testBundle = $this->container->get('entity_type.manager')->getStorage('media_bundle')->load('document'); | 
| 47 | 47 | |
| 48 | 48 | $adminUser = $this->drupalCreateUser([ | 
| 49 | - 'view media', | |
| 50 | - 'create media', | |
| 51 | - 'update media', | |
| 52 | - 'update any media', | |
| 53 | - 'delete media', | |
| 54 | - 'delete any media', | |
| 55 | - 'access media overview', | |
| 49 | + 'view media', | |
| 50 | + 'create media', | |
| 51 | + 'update media', | |
| 52 | + 'update any media', | |
| 53 | + 'delete media', | |
| 54 | + 'delete any media', | |
| 55 | + 'access media overview', | |
| 56 | 56 | ]); | 
| 57 | 57 | $this->drupalLogin($adminUser); | 
| 58 | - } | |
| 58 | + } | |
| 59 | 59 | |
| 60 | - /** | |
| 61 | - * Tests document media bundle creation from config files. | |
| 62 | - */ | |
| 63 | -  public function testMediaBundleCreationFromModule() { | |
| 60 | + /** | |
| 61 | + * Tests document media bundle creation from config files. | |
| 62 | + */ | |
| 63 | +    public function testMediaBundleCreationFromModule() { | |
| 64 | 64 | $type_configuration = [ | 
| 65 | - 'source_field' => 'field_document', | |
| 65 | + 'source_field' => 'field_document', | |
| 66 | 66 | ]; | 
| 67 | 67 | $field_map = [ | 
| 68 | - 'mime' => 'field_mime_type', | |
| 69 | - 'size' => 'field_document_size', | |
| 68 | + 'mime' => 'field_mime_type', | |
| 69 | + 'size' => 'field_document_size', | |
| 70 | 70 | ]; | 
| 71 | 71 | |
| 72 | 72 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); | 
| @@ -75,60 +75,60 @@ discard block | ||
| 75 | 75 |      $this->assertEqual($this->testBundle->get('type'), 'document', 'Correct plugin ID detected.'); | 
| 76 | 76 |      $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.'); | 
| 77 | 77 |      $this->assertEqual($this->testBundle->get('field_map'), $field_map, 'Correct field map detected.'); | 
| 78 | - } | |
| 78 | + } | |
| 79 | 79 | |
| 80 | - /** | |
| 81 | - * Tests thumbnails of the document items. | |
| 82 | - */ | |
| 83 | -  public function testDocumentItemThumbnail() { | |
| 80 | + /** | |
| 81 | + * Tests thumbnails of the document items. | |
| 82 | + */ | |
| 83 | +    public function testDocumentItemThumbnail() { | |
| 84 | 84 | $files = [ | 
| 85 | - 'Test.pdf' => 'public://media-icons/generic/application-pdf.png', | |
| 86 | - 'Test.doc' => 'public://media-icons/generic/application-msword.png', | |
| 87 | - 'Test.docx' => 'public://media-icons/generic/application-vnd.openxmlformats-officedocument.wordprocessingml.document.png', | |
| 88 | - 'Test.ods' => 'public://media-icons/generic/application-vnd.oasis.opendocument.spreadsheet.png', | |
| 89 | - 'Test.odt' => 'public://media-icons/generic/application-vnd.oasis.opendocument.text.png', | |
| 90 | - 'Test.ott' => 'public://media-icons/generic/application-vnd.oasis.opendocument.text-template.png', | |
| 91 | - 'Test.ppt' => 'public://media-icons/generic/application-vnd.ms-powerpoint.png', | |
| 92 | - 'Test.pptx' => 'public://media-icons/generic/application-vnd.openxmlformats-officedocument.presentationml.presentation.png', | |
| 93 | - 'Test.rtf' => 'public://media-icons/generic/application-rtf.png', | |
| 94 | - 'Test.txt' => 'public://media-icons/generic/text-plain.png', | |
| 95 | - 'Test.xls' => 'public://media-icons/generic/application-vnd.ms-excel.png', | |
| 96 | - 'Test.xlsx' => 'public://media-icons/generic/application-vnd.openxmlformats-officedocument.spreadsheetml.sheet.png', | |
| 85 | + 'Test.pdf' => 'public://media-icons/generic/application-pdf.png', | |
| 86 | + 'Test.doc' => 'public://media-icons/generic/application-msword.png', | |
| 87 | + 'Test.docx' => 'public://media-icons/generic/application-vnd.openxmlformats-officedocument.wordprocessingml.document.png', | |
| 88 | + 'Test.ods' => 'public://media-icons/generic/application-vnd.oasis.opendocument.spreadsheet.png', | |
| 89 | + 'Test.odt' => 'public://media-icons/generic/application-vnd.oasis.opendocument.text.png', | |
| 90 | + 'Test.ott' => 'public://media-icons/generic/application-vnd.oasis.opendocument.text-template.png', | |
| 91 | + 'Test.ppt' => 'public://media-icons/generic/application-vnd.ms-powerpoint.png', | |
| 92 | + 'Test.pptx' => 'public://media-icons/generic/application-vnd.openxmlformats-officedocument.presentationml.presentation.png', | |
| 93 | + 'Test.rtf' => 'public://media-icons/generic/application-rtf.png', | |
| 94 | + 'Test.txt' => 'public://media-icons/generic/text-plain.png', | |
| 95 | + 'Test.xls' => 'public://media-icons/generic/application-vnd.ms-excel.png', | |
| 96 | + 'Test.xlsx' => 'public://media-icons/generic/application-vnd.openxmlformats-officedocument.spreadsheetml.sheet.png', | |
| 97 | 97 | ]; | 
| 98 | 98 | |
| 99 | 99 |      foreach ($files as $fileName => $thumbnail) { | 
| 100 | -      $file = drupal_get_path('module', 'media') . '/files/' . $fileName; | |
| 101 | - $name = $this->randomMachineName(); | |
| 102 | -      $this->drupalGet('media/add/document'); | |
| 103 | - $edit = [ | |
| 100 | +        $file = drupal_get_path('module', 'media') . '/files/' . $fileName; | |
| 101 | + $name = $this->randomMachineName(); | |
| 102 | +        $this->drupalGet('media/add/document'); | |
| 103 | + $edit = [ | |
| 104 | 104 | 'files[field_document_0]' => $file, | 
| 105 | - ]; | |
| 106 | - $this->drupalPostAjaxForm(NULL, $edit, "field_document_0_upload_button"); | |
| 107 | -      $fid = (string) current($this->xpath('//input[@data-drupal-selector="edit-field-document-0-fids"]/@value')); | |
| 108 | - $edit = [ | |
| 105 | + ]; | |
| 106 | + $this->drupalPostAjaxForm(NULL, $edit, "field_document_0_upload_button"); | |
| 107 | +        $fid = (string) current($this->xpath('//input[@data-drupal-selector="edit-field-document-0-fids"]/@value')); | |
| 108 | + $edit = [ | |
| 109 | 109 | 'name[0][value]' => $name, | 
| 110 | 110 | 'form_id' => 'media_document_form', | 
| 111 | 111 | 'field_document[0][fids]' => $fid, | 
| 112 | 112 | 'field_document[0][display]' => 1, | 
| 113 | - ]; | |
| 114 | -      $this->drupalPostForm(NULL, $edit, t('Save and publish')); | |
| 115 | - $recentThumbnail = $this->getMostRecentThumbnail(); | |
| 116 | - $this->assertEqual($thumbnail, $recentThumbnail, "Correct thumbnail detected for " . $fileName); | |
| 113 | + ]; | |
| 114 | +        $this->drupalPostForm(NULL, $edit, t('Save and publish')); | |
| 115 | + $recentThumbnail = $this->getMostRecentThumbnail(); | |
| 116 | + $this->assertEqual($thumbnail, $recentThumbnail, "Correct thumbnail detected for " . $fileName); | |
| 117 | + } | |
| 117 | 118 | } | 
| 118 | - } | |
| 119 | 119 | |
| 120 | - /** | |
| 121 | - * Returns the thumbnail of the most recent document. | |
| 122 | - * | |
| 123 | - * @return string | |
| 124 | - * Path of the thumbnail. | |
| 125 | - */ | |
| 126 | -  public function getMostRecentThumbnail() { | |
| 120 | + /** | |
| 121 | + * Returns the thumbnail of the most recent document. | |
| 122 | + * | |
| 123 | + * @return string | |
| 124 | + * Path of the thumbnail. | |
| 125 | + */ | |
| 126 | +    public function getMostRecentThumbnail() { | |
| 127 | 127 |      $document_id = $this->container->get('entity.query')->get('media')->condition('bundle', 'document')->sort('created', 'DESC')->execute(); | 
| 128 | 128 |      $item = $this->container->get('entity_type.manager') | 
| 129 | -      ->getStorage('media') | |
| 130 | - ->loadUnchanged(reset($document_id)); | |
| 129 | +        ->getStorage('media') | |
| 130 | + ->loadUnchanged(reset($document_id)); | |
| 131 | 131 | return $item->getType()->thumbnail($item); | 
| 132 | - } | |
| 132 | + } | |
| 133 | 133 | |
| 134 | 134 | } | 
| @@ -10,69 +10,69 @@ discard block | ||
| 10 | 10 | * @group media | 
| 11 | 11 | */ | 
| 12 | 12 |  class TweetBundleTest extends WebTestBase { | 
| 13 | - /** | |
| 14 | - * Exempt from strict schema checking. | |
| 15 | - * | |
| 16 | - * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | - * | |
| 18 | - * @var bool | |
| 19 | - */ | |
| 20 | - protected $strictConfigSchema = FALSE; | |
| 13 | + /** | |
| 14 | + * Exempt from strict schema checking. | |
| 15 | + * | |
| 16 | + * @see \Drupal\Core\Config\Testing\ConfigSchemaChecker | |
| 17 | + * | |
| 18 | + * @var bool | |
| 19 | + */ | |
| 20 | + protected $strictConfigSchema = FALSE; | |
| 21 | 21 | |
| 22 | - /** | |
| 23 | - * Modules to enable. | |
| 24 | - * | |
| 25 | - * @var array | |
| 26 | - */ | |
| 27 | - public static $modules = [ | |
| 22 | + /** | |
| 23 | + * Modules to enable. | |
| 24 | + * | |
| 25 | + * @var array | |
| 26 | + */ | |
| 27 | + public static $modules = [ | |
| 28 | 28 | 'media', | 
| 29 | 29 | 'media_entity', | 
| 30 | 30 | 'media_entity_twitter', | 
| 31 | 31 | 'node', | 
| 32 | 32 | 'link', | 
| 33 | - ]; | |
| 33 | + ]; | |
| 34 | 34 | |
| 35 | - /** | |
| 36 | - * The test media bundle. | |
| 37 | - * | |
| 38 | - * @var \Drupal\media_entity\MediaBundleInterface | |
| 39 | - */ | |
| 40 | - protected $testBundle; | |
| 35 | + /** | |
| 36 | + * The test media bundle. | |
| 37 | + * | |
| 38 | + * @var \Drupal\media_entity\MediaBundleInterface | |
| 39 | + */ | |
| 40 | + protected $testBundle; | |
| 41 | 41 | |
| 42 | - /** | |
| 43 | -   * {@inheritdoc} | |
| 44 | - */ | |
| 45 | -  protected function setUp() { | |
| 42 | + /** | |
| 43 | +     * {@inheritdoc} | |
| 44 | + */ | |
| 45 | +    protected function setUp() { | |
| 46 | 46 | parent::setUp(); | 
| 47 | 47 |      $this->testBundle = $this->container->get('entity.manager')->getStorage('media_bundle')->load('tweet'); | 
| 48 | 48 | |
| 49 | 49 | $adminUser = $this->drupalCreateUser([ | 
| 50 | - 'view media', | |
| 51 | - 'create media', | |
| 52 | - 'update media', | |
| 53 | - 'update any media', | |
| 54 | - 'delete media', | |
| 55 | - 'delete any media', | |
| 56 | - 'access media overview', | |
| 50 | + 'view media', | |
| 51 | + 'create media', | |
| 52 | + 'update media', | |
| 53 | + 'update any media', | |
| 54 | + 'delete media', | |
| 55 | + 'delete any media', | |
| 56 | + 'access media overview', | |
| 57 | 57 | ]); | 
| 58 | 58 | $this->drupalLogin($adminUser); | 
| 59 | - } | |
| 59 | + } | |
| 60 | 60 | |
| 61 | - /** | |
| 62 | - * Tests tweet media bundle creation from config files. | |
| 63 | - */ | |
| 64 | -  public function testMediaBundleCreationFromModule() { | |
| 61 | + /** | |
| 62 | + * Tests tweet media bundle creation from config files. | |
| 63 | + */ | |
| 64 | +    public function testMediaBundleCreationFromModule() { | |
| 65 | 65 | $type_configuration = [ | 
| 66 | - 'use_twitter_api' => FALSE, | |
| 67 | - 'source_field' => 'field_tweet_url', | |
| 68 | - 'consumer_key' => '', | |
| 69 | - 'consumer_secret' => '', | |
| 70 | - 'oauth_access_token' => '', | |
| 71 | - 'oauth_access_token_secret' => '', | |
| 66 | + 'use_twitter_api' => FALSE, | |
| 67 | + 'source_field' => 'field_tweet_url', | |
| 68 | + 'consumer_key' => '', | |
| 69 | + 'consumer_secret' => '', | |
| 70 | + 'oauth_access_token' => '', | |
| 71 | + 'oauth_access_token_secret' => '', | |
| 72 | 72 | ]; | 
| 73 | 73 | $field_map = [ | 
| 74 | - 'id' => 'field_tweet_id', | |
| 75 | - 'user' => 'field_tweet_author', | |
| 74 | + 'id' => 'field_tweet_id', | |
| 75 | + 'user' => 'field_tweet_author', | |
| 76 | 76 | ]; | 
| 77 | 77 | |
| 78 | 78 | $this->assertTrue((bool) $this->testBundle, 'The media bundle from default configuration has been created in the database.'); | 
| @@ -81,18 +81,18 @@ discard block | ||
| 81 | 81 |      $this->assertEqual($this->testBundle->get('type'), 'twitter', 'Correct plugin ID detected.'); | 
| 82 | 82 |      $this->assertEqual($this->testBundle->get('type_configuration'), $type_configuration, 'Type configuration correct.'); | 
| 83 | 83 |      $this->assertEqual($this->testBundle->get('field_map'), $field_map, 'Correct field map detected.'); | 
| 84 | - } | |
| 84 | + } | |
| 85 | 85 | |
| 86 | - /** | |
| 87 | - * Tests item creation. | |
| 88 | - */ | |
| 89 | -  public function testMediaBundleItemCreation() { | |
| 86 | + /** | |
| 87 | + * Tests item creation. | |
| 88 | + */ | |
| 89 | +    public function testMediaBundleItemCreation() { | |
| 90 | 90 | // Define the media item name. | 
| 91 | 91 | $name = $this->randomMachineName(); | 
| 92 | 92 | $tweet_url = 'https://twitter.com/jack/status/20'; | 
| 93 | 93 | $edit = [ | 
| 94 | - 'name[0][value]' => $name, | |
| 95 | - 'field_tweet_url[0][uri]' => $tweet_url, | |
| 94 | + 'name[0][value]' => $name, | |
| 95 | + 'field_tweet_url[0][uri]' => $tweet_url, | |
| 96 | 96 | ]; | 
| 97 | 97 | |
| 98 | 98 | // Save the tweet. | 
| @@ -101,11 +101,11 @@ discard block | ||
| 101 | 101 |      $media_id = $this->container->get('entity.query')->get('media')->condition('bundle', 'tweet')->sort('created', 'DESC')->execute(); | 
| 102 | 102 | $media_id = reset($media_id); | 
| 103 | 103 |      $media = $this->container->get('entity_type.manager') | 
| 104 | -      ->getStorage('media') | |
| 105 | - ->loadUnchanged($media_id); | |
| 104 | +        ->getStorage('media') | |
| 105 | + ->loadUnchanged($media_id); | |
| 106 | 106 | $properties = $media->toArray(); | 
| 107 | 107 |      $this->assertEqual($media->get('field_tweet_author')[0]->getValue()['value'], "jack", "Correct tweet author stored."); | 
| 108 | 108 |      $this->assertEqual($media->get('field_tweet_id')[0]->getValue()['value'], "20", "Correct tweet id stored."); | 
| 109 | - } | |
| 109 | + } | |
| 110 | 110 | |
| 111 | 111 | } | 
| @@ -11,45 +11,45 @@ discard block | ||
| 11 | 11 | */ | 
| 12 | 12 |  class EmbedButtonTest extends JavascriptTestBase { | 
| 13 | 13 | |
| 14 | - /** | |
| 15 | -   * {@inheritdoc} | |
| 16 | - */ | |
| 17 | - public static $modules = [ | |
| 14 | + /** | |
| 15 | +     * {@inheritdoc} | |
| 16 | + */ | |
| 17 | + public static $modules = [ | |
| 18 | 18 | 'node', | 
| 19 | 19 | 'path', | 
| 20 | 20 | 'text', | 
| 21 | - ]; | |
| 21 | + ]; | |
| 22 | 22 | |
| 23 | - /** | |
| 24 | -   * {@inheritdoc} | |
| 25 | - */ | |
| 26 | -  public function setUp() { | |
| 23 | + /** | |
| 24 | +     * {@inheritdoc} | |
| 25 | + */ | |
| 26 | +    public function setUp() { | |
| 27 | 27 | parent::setUp(); | 
| 28 | 28 | // Manually installing modules to preserve the order. | 
| 29 | 29 |      $this->installModule('media_embed_test'); | 
| 30 | 30 |      $this->installModule('media'); | 
| 31 | 31 | $adminUser = $this->drupalCreateUser([ | 
| 32 | - 'access content', | |
| 33 | - 'use text format basic_html', | |
| 34 | - 'use text format full_html', | |
| 35 | - 'access media_embed entity browser pages', | |
| 36 | - 'view media', | |
| 37 | - 'create media', | |
| 38 | - 'update media', | |
| 39 | - 'update any media', | |
| 40 | - 'delete media', | |
| 41 | - 'delete any media', | |
| 42 | - 'access media overview', | |
| 43 | - 'create page content', | |
| 44 | - 'edit any page content', | |
| 32 | + 'access content', | |
| 33 | + 'use text format basic_html', | |
| 34 | + 'use text format full_html', | |
| 35 | + 'access media_embed entity browser pages', | |
| 36 | + 'view media', | |
| 37 | + 'create media', | |
| 38 | + 'update media', | |
| 39 | + 'update any media', | |
| 40 | + 'delete media', | |
| 41 | + 'delete any media', | |
| 42 | + 'access media overview', | |
| 43 | + 'create page content', | |
| 44 | + 'edit any page content', | |
| 45 | 45 | ]); | 
| 46 | 46 | $this->drupalLogin($adminUser); | 
| 47 | - } | |
| 47 | + } | |
| 48 | 48 | |
| 49 | - /** | |
| 50 | - * Tests that the entity embed dialog is working. | |
| 51 | - */ | |
| 52 | -  public function testMediaEmbedDialog() { | |
| 49 | + /** | |
| 50 | + * Tests that the entity embed dialog is working. | |
| 51 | + */ | |
| 52 | +    public function testMediaEmbedDialog() { | |
| 53 | 53 | // Find the button and click it to see if the modal opens. | 
| 54 | 54 |      $this->drupalGet('node/add/page'); | 
| 55 | 55 |      $this->find('.cke_button__media')->click(); | 
| @@ -71,38 +71,38 @@ discard block | ||
| 71 | 71 | $this->assertEquals(200, $this->getSession()->getStatusCode()); | 
| 72 | 72 |      $filter = $this->getSession()->getPage()->find('css', 'input[name="name"]'); | 
| 73 | 73 | $this->assertTrue($filter, "Found filter"); | 
| 74 | - } | |
| 74 | + } | |
| 75 | 75 | |
| 76 | - /** | |
| 77 | - * Installs the module using module_handler service. | |
| 78 | - * | |
| 79 | - * @param string $module_name | |
| 80 | - * Name of the module to install. | |
| 81 | - */ | |
| 82 | -  public function installModule($module_name) { | |
| 76 | + /** | |
| 77 | + * Installs the module using module_handler service. | |
| 78 | + * | |
| 79 | + * @param string $module_name | |
| 80 | + * Name of the module to install. | |
| 81 | + */ | |
| 82 | +    public function installModule($module_name) { | |
| 83 | 83 |      if (!$this->container->get('module_handler')->moduleExists($module_name)) { | 
| 84 | -      $this->container->get('module_installer')->install(array($module_name)); | |
| 84 | +        $this->container->get('module_installer')->install(array($module_name)); | |
| 85 | + } | |
| 85 | 86 | } | 
| 86 | - } | |
| 87 | 87 | |
| 88 | - /** | |
| 89 | - * Wait for AJAX. | |
| 90 | - */ | |
| 91 | -  protected function wait() { | |
| 88 | + /** | |
| 89 | + * Wait for AJAX. | |
| 90 | + */ | |
| 91 | +    protected function wait() { | |
| 92 | 92 | $this->getSession()->wait(20000, '(0 === jQuery.active)'); | 
| 93 | - } | |
| 93 | + } | |
| 94 | 94 | |
| 95 | - /** | |
| 96 | - * Find an element based on a CSS selector. | |
| 97 | - * | |
| 98 | - * @param string $css_selector | |
| 99 | - * A css selector to find an element for. | |
| 100 | - * | |
| 101 | - * @return \Behat\Mink\Element\NodeElement|null | |
| 102 | - * The found element or null. | |
| 103 | - */ | |
| 104 | -  protected function find($css_selector) { | |
| 95 | + /** | |
| 96 | + * Find an element based on a CSS selector. | |
| 97 | + * | |
| 98 | + * @param string $css_selector | |
| 99 | + * A css selector to find an element for. | |
| 100 | + * | |
| 101 | + * @return \Behat\Mink\Element\NodeElement|null | |
| 102 | + * The found element or null. | |
| 103 | + */ | |
| 104 | +    protected function find($css_selector) { | |
| 105 | 105 |      return $this->getSession()->getPage()->find('css', $css_selector); | 
| 106 | - } | |
| 106 | + } | |
| 107 | 107 | |
| 108 | 108 | } |