You are here

public function Update360Test::testUpdate in Lightning Core 8.5

Tests optional updates targeting Lightning Core 3.6.0.

File

tests/src/Kernel/Update/Update360Test.php, line 40

Class

Update360Test
Tests optional updates targeting Lightning Core 3.6.0.

Namespace

Drupal\Tests\lightning_core\Kernel\Update

Code

public function testUpdate() : void {
  $this
    ->assertFalse($this->container
    ->get('module_handler')
    ->moduleExists('image'));
  $this
    ->assertNull(FieldConfig::loadByName('user', 'user', 'user_picture'));
  $this
    ->assertTrue($this
    ->getCompactDisplay()
    ->isNew());
  Update360::create($this->container)
    ->enableUserPictures();

  // The update installed a module, which means the container has been reset.
  $this->container = $this->container
    ->get('kernel')
    ->getContainer();
  $this
    ->assertTrue($this->container
    ->get('module_handler')
    ->moduleExists('image'));
  $this
    ->assertInstanceOf(FieldConfig::class, FieldConfig::loadByName('user', 'user', 'user_picture'));
  $display = $this
    ->getCompactDisplay();
  $this
    ->assertFalse($display
    ->isNew());
  $this
    ->assertIsArray($display
    ->getComponent('name'));
  $this
    ->assertIsArray($display
    ->getComponent('user_picture'));
}