EntityFormModeUpdatePathTest.php
Namespace
Drupal\Tests\system\Functional\UpdateFile
- 
              core/modules/ system/ tests/ src/ Functional/ Update/ EntityFormModeUpdatePathTest.php 
View source
<?php
declare (strict_types=1);
namespace Drupal\Tests\system\Functional\Update;
use Drupal\Core\Entity\Entity\EntityFormMode;
use Drupal\FunctionalTests\Update\UpdatePathTestBase;
use PHPUnit\Framework\Attributes\Group;
use PHPUnit\Framework\Attributes\RunTestsInSeparateProcesses;
/**
 * Tests update path for the entity form mode description value from '' to NULL.
 */
class EntityFormModeUpdatePathTest extends UpdatePathTestBase {
  
  /**
   * {@inheritdoc}
   */
  protected function setDatabaseDumpFiles() : void {
    $this->databaseDumpFiles = [
      __DIR__ . '/../../../../../system/tests/fixtures/update/drupal-10.3.0.filled.standard.php.gz',
      __DIR__ . '/../../../../../system/tests/fixtures/update/remove-description-from-user-register-form-mode.php',
    ];
  }
  
  /**
   * Tests update path for the entity form mode description value from '' to NULL.
   */
  public function testRunUpdates() : void {
    $form_mode = EntityFormMode::load('user.register');
    $this->assertInstanceOf(EntityFormMode::class, $form_mode);
    $this->assertSame("\n", $form_mode->get('description'));
    $this->assertSame("\n", $form_mode->getDescription());
    $this->runUpdates();
    $form_mode = EntityFormMode::load('user.register');
    $this->assertInstanceOf(EntityFormMode::class, $form_mode);
    $this->assertNull($form_mode->get('description'));
    // Assert backward compatibility of EntityFormMode::getDescription().
    $this->assertSame('', $form_mode->getDescription());
  }
}Classes
| Title | Deprecated | Summary | 
|---|---|---|
| EntityFormModeUpdatePathTest | Tests update path for the entity form mode description value from '' to NULL. | 
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.
