UpdateSchemaTest.php

Same filename in this branch
  1. 9 core/modules/system/tests/src/Functional/UpdateSystem/UpdateSchemaTest.php
Same filename in other branches
  1. 8.9.x core/modules/system/tests/src/Functional/UpdateSystem/UpdateSchemaTest.php
  2. 10 core/modules/system/tests/src/Functional/UpdateSystem/UpdateSchemaTest.php
  3. 10 core/tests/Drupal/KernelTests/Core/Extension/UpdateSchemaTest.php
  4. 11.x core/modules/system/tests/src/Functional/UpdateSystem/UpdateSchemaTest.php
  5. 11.x core/tests/Drupal/KernelTests/Core/Extension/UpdateSchemaTest.php

Namespace

Drupal\KernelTests\Core\Extension

File

core/tests/Drupal/KernelTests/Core/Extension/UpdateSchemaTest.php

View source
<?php

namespace Drupal\KernelTests\Core\Extension;

use Drupal\KernelTests\KernelTestBase;

/**
 * Tests for schema and update includes.
 *
 * @group Core
 */
class UpdateSchemaTest extends KernelTestBase {
    
    /**
     * {@inheritdoc}
     */
    protected static $modules = [
        'update_test_schema',
    ];
    
    /**
     * Tests the function parses schema updates as integer numbers.
     *
     * @see \Drupal\Core\Update\UpdateHookRegistry::getAvailableUpdates()
     */
    public function testDrupalGetSchemaVersionsInt() {
        \Drupal::state()->set('update_test_schema_version', 8001);
        $this->installSchema('update_test_schema', [
            'update_test_schema_table',
        ]);
        $schema = \Drupal::service('update.update_hook_registry')->getAvailableUpdates('update_test_schema');
        foreach ($schema as $version) {
            $this->assertIsInt($version);
        }
    }

}

Classes

Title Deprecated Summary
UpdateSchemaTest Tests for schema and update includes.

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.