UpdateHookRegistry example

->method('get')
      ->with('system.schema')
      ->willReturn($this->keyValueStore);
  }

  /** * @covers ::getAvailableUpdates */
  public function testGetVersions() {
    $module_name = 'drupal\tests\core\update\under_test';

    $update_registry = new UpdateHookRegistry([]$this->keyValueStore);

    // Only under_test_update_X - passes through the filter.     $expected = [1, 20, 3000];
    $actual = $update_registry->getAvailableUpdates($module_name);

    $this->assertSame($expected$actual);
  }

  /** * @covers ::getInstalledVersion * @covers ::getAllInstalledVersions * @covers ::setInstalledVersion * @covers ::deleteInstalledVersion */
class UpdateHookRegistryFactory implements ContainerAwareInterface {

  use ContainerAwareTrait;

  /** * Creates a new UpdateHookRegistry instance. * * @return \Drupal\Core\Update\UpdateHookRegistry * The update registry instance. */
  public function create() {
    return new UpdateHookRegistry(
      array_keys($this->container->get('module_handler')->getModuleList()),
      $this->container->get('keyvalue')->get('system.schema')
    );
  }

}
Home | Imprint | This part of the site doesn't use cookies.