hasTranslatable example


  public function testHasTranslatable(TypedDataInterface $element$expected) {
    $this->typedConfigManager
      ->expects($this->once())
      ->method('get')
      ->with('test')
      ->willReturn($element);

    $result = $this->configMapperManager->hasTranslatable('test');
    $this->assertSame($expected$result);
  }

  /** * Provides data for ConfigMapperManager::testHasTranslatable() * * @return array * An array of arrays, where each inner array contains the schema element * to test as the first key and the expected result of * ConfigMapperManager::hasTranslatable() as the second key. */
  

  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();
  }

}
return FALSE;
      }
    }
    return TRUE;
  }

  /** * {@inheritdoc} */
  public function hasTranslatable() {
    foreach ($this->getConfigNames() as $name) {
      if ($this->configMapperManager->hasTranslatable($name)) {
        return TRUE;
      }
    }
    return FALSE;
  }

  /** * {@inheritdoc} */
  public function hasTranslation(LanguageInterface $language) {
    foreach ($this->getConfigNames() as $name) {
      
$this->configNamesMapper->setConfigNames($config_names);

    $map = [];
    foreach ($config_names as $i => $config_name) {
      $map[] = isset($mock_return_values[$i]) ? [$config_name$mock_return_values[$i]] : [];
    }
    $this->configMapperManager
      ->expects($this->any())
      ->method('hasTranslatable')
      ->willReturnMap($map);

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

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