UpdateSchemaTest.php in Drupal 9        
                          
                  
                        
  
  
  
  
File
  core/tests/Drupal/KernelTests/Core/Extension/UpdateSchemaTest.php
  
    View source  
  <?php
namespace Drupal\KernelTests\Core\Extension;
use Drupal\KernelTests\KernelTestBase;
class UpdateSchemaTest extends KernelTestBase {
  
  protected static $modules = [
    'update_test_schema',
  ];
  
  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);
    }
  }
}