hasSchema example


  protected function doCheckAccess(AccountInterface $account, ConfigMapperInterface $mapper$source_language = NULL) {
    $access =
      $account->hasPermission('translate configuration') &&
      $mapper->hasSchema() &&
      $mapper->hasTranslatable() &&
      (!$source_language || !$source_language->isLocked());

    return AccessResult::allowedIf($access)->cachePerPermissions();
  }

}
$this->configNamesMapper->setConfigNames($config_names);

    $map = [];
    foreach ($config_names as $i => $config_name) {
      $map[] = [$config_name$mock_return_values[$i]];
    }
    $this->typedConfigManager
      ->expects($this->any())
      ->method('hasConfigSchema')
      ->willReturnMap($map);

    $result = $this->configNamesMapper->hasSchema();
    $this->assertSame($expected$result);
  }

  /** * Provides data for ConfigMapperTest::testHasSchema(). * * @return array * An array of arrays, where each inner array has an array of values that * the mocked locale configuration manager should return for * hasConfigSchema() as the first value and the expected return value of * ConfigNamesMapper::hasSchema() as the second value. */
Home | Imprint | This part of the site doesn't use cookies.