Completed
Push — 8.x-1.x ( 729d7d...e0281d )
by Janez
02:47
created

EntityBrowserUpdateHookTest::doSelectionTest()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 4
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 3
c 1
b 0
f 0
nc 1
nop 0
dl 0
loc 4
rs 10
1
<?php
2
3
namespace Drupal\entity_browser\Tests;
4
5
use Drupal\system\Tests\Update\UpdatePathTestBase;
6
7
/**
8
 * Tests the update hooks in entity_browser module.
9
 *
10
 * @group entity_browser
11
 */
12
class EntityBrowserUpdateHookTest 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_browser.update-hook-test.php',
21
    ];
22
  }
23
24
  /**
25
   * {@inheritdoc}
26
   */
27
  protected function setUp() {
28
    parent::setUp();
29
    $entity_browser_type = $this->container
30
      ->get('entity_type.manager')
31
      ->getDefinition('entity_browser');
32
33
    $this->container
34
      ->get('entity.last_installed_schema.repository')
35
      ->setLastInstalledDefinition($entity_browser_type);
36
  }
37
38
  /**
39
   * {@inheritdoc}
40
   */
41
  protected function doSelectionTest() {
42
    parent::doSelectionTest();
43
    $this->assertRaw('8001 -   Updates submit text for existing Entity browsers.');
44
  }
45
46
  /**
47
   * Tests entity_browser_update_8001().
48
   */
49
  public function testSubmitTextUpdate() {
50
    $this->runUpdates();
51
    $browser = $this->container->get('config.factory')
52
      ->get('entity_browser.browser.test_update');
53
54
    $this->assertNull($browser->get('submit_text'), 'Old submit text is gone');
55
    $this->assertEqual($browser->get('widgets.a4ad947c-9669-497c-9988-24351955a02f.settings.submit_text'), 'All animals are created equal','New submit text appears on the widget.');
56
  }
57
58
}
59