Completed
Push — 8.x-1.x ( b5c62b...8d65d1 )
by Janez
06:41
created

EntityEmbedUpdateHookTest::setUp()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 8

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 1 Features 0
Metric Value
cc 1
eloc 8
c 1
b 1
f 0
nc 1
nop 0
dl 0
loc 10
rs 9.4285
1
<?php
2
3
namespace Drupal\entity_embed\Tests;
4
5
use Drupal\system\Tests\Update\UpdatePathTestBase;
6
7
/**
8
 * Tests the update hooks in entity_embed module.
9
 *
10
 * @group entity_embed
11
 */
12
class EntityEmbedUpdateHookTest extends UpdatePathTestBase {
13
14
  /**
15
   * Set database dump files to be used.
16
   */
17
  protected function setDatabaseDumpFiles() {
18
    $this->databaseDumpFiles = [
19
      DRUPAL_ROOT . '/core/modules/system/tests/fixtures/update/drupal-8.bare.standard.php.gz',
20
      __DIR__ . '/../../tests/fixtures/update/entity_embed.update-hook-test.php',
21
    ];
22
  }
23
24
  /**
25
   * {@inheritdoc}
26
   */
27
  protected function setUp() {
28
    parent::setUp();
29
    $button = $this->container
30
      ->get('entity_type.manager')
31
      ->getDefinition('embed_button');
32
33
    $this->container
34
      ->get('entity.last_installed_schema.repository')
35
      ->setLastInstalledDefinition($button);
36
  }
37
38
  /**
39
   * {@inheritdoc}
40
   */
41
  protected function doSelectionTest() {
42
    parent::doSelectionTest();
43
    $this->assertRaw('8002 -   Updates the default mode settings.');
44
  }
45
46
  /**
47
   * Tests entity_embed_update_8002().
48
   */
49
  public function testPostUpdate() {
50
    $this->runUpdates();
51
    $mode = $this->container->get('config.factory')
52
      ->get('entity_embed.settings')
53
      ->get('rendered_entity_mode');
54
    $this->assertTrue($mode, 'Render entity mode settings after update is correct.');
55
  }
56
57
}
58