class FormatPluralUpdateTest
Tests the upgrade path for converting format_plural from integer to boolean.
@group Update
Hierarchy
- class \Drupal\Tests\BrowserTestBase uses \Drupal\Core\Test\FunctionalTestSetupTrait, \Drupal\Tests\UiHelperTrait, \Drupal\Core\Test\TestSetupTrait, \Drupal\Tests\block\Traits\BlockCreationTrait, \Drupal\Tests\RandomGeneratorTrait, \Drupal\Tests\node\Traits\NodeCreationTrait, \Drupal\Tests\node\Traits\ContentTypeCreationTrait, \Drupal\Tests\ConfigTestTrait, \Drupal\Tests\TestRequirementsTrait, \Drupal\Tests\user\Traits\UserCreationTrait, \Drupal\Tests\XdebugRequestTrait, \Drupal\Tests\PhpUnitCompatibilityTrait, \Drupal\TestTools\Extension\DeprecationBridge\ExpectDeprecationTrait, \Drupal\Tests\ExtensionListTestTrait extends \PHPUnit\Framework\TestCase
- class \Drupal\FunctionalTests\Update\UpdatePathTestBase uses \Drupal\Tests\UpdatePathTestTrait extends \Drupal\Tests\BrowserTestBase
- class \Drupal\Tests\views\Functional\Update\FormatPluralUpdateTest extends \Drupal\FunctionalTests\Update\UpdatePathTestBase
- class \Drupal\FunctionalTests\Update\UpdatePathTestBase uses \Drupal\Tests\UpdatePathTestTrait extends \Drupal\Tests\BrowserTestBase
Expanded class hierarchy of FormatPluralUpdateTest
See also
views_post_update_format_plural()
File
-
core/
modules/ views/ tests/ src/ Functional/ Update/ FormatPluralUpdateTest.php, line 17
Namespace
Drupal\Tests\views\Functional\UpdateView source
class FormatPluralUpdateTest extends UpdatePathTestBase {
/**
* {@inheritdoc}
*/
protected function setDatabaseDumpFiles() : void {
$this->databaseDumpFiles = [
__DIR__ . '/../../../../../system/tests/fixtures/update/drupal-10.3.0.filled.standard.php.gz',
__DIR__ . '/../../../fixtures/update/format-plural.php',
];
}
/**
* Tests that fields with the format_plural option are updated properly.
*/
public function testViewsFieldFormatPluralConversion() : void {
$view = View::load('test_format_plural_update');
$data = $view->toArray();
$this->assertSame(0, $data['display']['default']['display_options']['fields']['uid']['format_plural']);
$this->runUpdates();
$view = View::load('test_format_plural_update');
$data = $view->toArray();
// Ensure that integer 0 has become a boolean false.
$this->assertFalse($data['display']['default']['display_options']['fields']['uid']['format_plural']);
}
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.