Drupal 8  8.0.2
LocaleUpdateBase Class Reference
Inheritance diagram for LocaleUpdateBase:

Static Public Attributes

static $modules = array('locale', 'locale_test')
 

Protected Member Functions

 setUp ()
 
 setTranslationsDirectory ($path)
 
 addLanguage ($langcode)
 
 makePoFile ($path, $filename, $timestamp=NULL, array $translations=array())
 
 setTranslationFiles ()
 
 setCurrentTranslations ()
 
 assertTranslation ($source, $translation, $langcode, $message= '')
 
- Protected Member Functions inherited from WebTestBase
 drupalCreateNode (array $settings=array())
 
 drupalCreateContentType (array $values=array())
 
 drupalBuildEntityView (EntityInterface $entity, $view_mode= 'full', $langcode=NULL, $reset=FALSE)
 
 drupalPlaceBlock ($plugin_id, array $settings=array())
 
 assertBlockAppears (Block $block)
 
 assertNoBlockAppears (Block $block)
 
 findBlockInstance (Block $block)
 
 drupalGetTestFiles ($type, $size=NULL)
 
 drupalCompareFiles ($file1, $file2)
 
 drupalLogin (AccountInterface $account)
 
 drupalUserIsLoggedIn ($account)
 
 drupalLogout ()
 
 setUp ()
 
 doInstall ()
 
 prepareSettings ()
 
 initSettings ()
 
 initConfig (ContainerInterface $container)
 
 rebuildAll ()
 
 installParameters ()
 
 setBatch ()
 
 restoreBatch ()
 
 initUserSession ()
 
 initKernel (Request $request)
 
 addCustomTranslations ($langcode, array $values)
 
 writeCustomTranslations ()
 
 rebuildContainer ()
 
 resetAll ()
 
 refreshVariables ()
 
 tearDown ()
 
 curlInitialize ()
 
 curlExec ($curl_options, $redirect=FALSE)
 
 curlHeaderCallback ($curlHandler, $header)
 
 curlClose ()
 
 isInChildSite ()
 
 drupalGet ($path, array $options=array(), array $headers=array())
 
 drupalGetJSON ($path, array $options=array(), array $headers=array())
 
 drupalGetWithFormat ($path, $format, array $options=[], array $headers=[])
 
 drupalGetAjax ($path, array $options=array(), array $headers=array())
 
 drupalGetXHR ($path, array $options=array(), array $headers=array())
 
 drupalPostForm ($path, $edit, $submit, array $options=array(), array $headers=array(), $form_html_id=NULL, $extra_post=NULL)
 
 drupalPostAjaxForm ($path, $edit, $triggering_element, $ajax_path=NULL, array $options=array(), array $headers=array(), $form_html_id=NULL, $ajax_settings=NULL)
 
 drupalProcessAjaxResponse ($content, array $ajax_response, array $ajax_settings, array $drupal_settings)
 
 drupalPost ($path, $accept, array $post, $options=array())
 
 drupalPostWithFormat ($path, $format, array $post, $options=[])
 
 getAjaxPageStatePostData ()
 
 serializePostValues ($post=array())
 
 translatePostValues (array $values)
 
 cronRun ()
 
 checkForMetaRefresh ()
 
 drupalHead ($path, array $options=array(), array $headers=array())
 
 handleForm (&$post, &$edit, &$upload, $submit, $form)
 
 clickLink ($label, $index=0)
 
 clickLinkPartialName ($label, $index=0)
 
 clickLinkHelper ($label, $index, $pattern)
 
 getAbsoluteUrl ($path)
 
 drupalGetHeaders ($all_requests=FALSE)
 
 drupalGetHeader ($name, $all_requests=FALSE)
 
 assertHeader ($header, $value, $message= '', $group= 'Browser')
 
 drupalGetMails ($filter=array())
 
 assertUrl ($path, array $options=array(), $message= '', $group= 'Other')
 
 assertResponse ($code, $message= '', $group= 'Browser')
 
 assertNoResponse ($code, $message= '', $group= 'Browser')
 
 assertMail ($name, $value= '', $message= '', $group= 'Email')
 
 assertMailString ($field_name, $string, $email_depth, $message= '', $group= 'Other')
 
 assertMailPattern ($field_name, $regex, $message= '', $group= 'Other')
 
 verboseEmail ($count=1)
 
 prepareRequestForGenerator ($clean_urls=TRUE, $override_server_vars=array())
 
 buildUrl ($path, array $options=array())
 
 assertCacheContext ($expected_cache_context)
 
 assertNoCacheContext ($not_expected_cache_context)
 
 assertCacheTag ($expected_cache_tag)
 
 assertNoCacheTag ($cache_tag)
 
 setHttpResponseDebugCacheabilityHeaders ($value=TRUE)
 
- Protected Member Functions inherited from TestBase
 setUp ()
 
 checkRequirements ()
 
 storeAssertion (array $assertion)
 
 assert ($status, $message= '', $group= 'Other', array $caller=NULL)
 
 getAssertionCall ()
 
 assertTrue ($value, $message= '', $group= 'Other')
 
 assertFalse ($value, $message= '', $group= 'Other')
 
 assertNull ($value, $message= '', $group= 'Other')
 
 assertNotNull ($value, $message= '', $group= 'Other')
 
 assertEqual ($first, $second, $message= '', $group= 'Other')
 
 assertNotEqual ($first, $second, $message= '', $group= 'Other')
 
 assertIdentical ($first, $second, $message= '', $group= 'Other')
 
 assertNotIdentical ($first, $second, $message= '', $group= 'Other')
 
 assertIdenticalObject ($object1, $object2, $message= '', $group= 'Other')
 
 assertNoErrorsLogged ()
 
 assertErrorLogged ($error_message)
 
 pass ($message=NULL, $group= 'Other')
 
 fail ($message=NULL, $group= 'Other')
 
 error ($message= '', $group= 'Other', array $caller=NULL)
 
 verbose ($message)
 
 beforePrepareEnvironment ()
 
 tearDown ()
 
 exceptionHandler ($exception)
 
 settingsSet ($name, $value)
 
 config ($name)
 
 getConfigSchemaExclusions ()
 

Protected Attributes

 $timestampOld
 
 $timestampMedium
 
 $timestampNew
 
 $timestampNow
 
- Protected Attributes inherited from WebTestBase
 $profile = 'testing'
 
 $url
 
 $curlHandle
 
 $assertAjaxHeader = TRUE
 
 $headers
 
 $cookies = array()
 
 $dumpHeaders = FALSE
 
 $loggedInUser = FALSE
 
 $rootUser
 
 $cookieFile = NULL
 
 $additionalCurlOptions = array()
 
 $originalBatch
 
 $originalUser = NULL
 
 $originalShutdownCallbacks = array()
 
 $sessionId = NULL
 
 $generatedTestFiles = FALSE
 
 $maximumRedirects = 5
 
 $redirectCount
 
 $maximumMetaRefreshCount = NULL
 
 $metaRefreshCount = 0
 
 $kernel
 
 $configDirectories = array()
 
 $curlCookies = array()
 
 $customTranslations
 
 $classLoader
 
- Protected Attributes inherited from TestBase
 $testId
 
 $siteDirectory = NULL
 
 $databasePrefix = NULL
 
 $timeLimit = 500
 
 $assertions = array()
 
 $skipClasses = array(__CLASS__ => TRUE)
 
 $verboseId = 0
 
 $verboseClassName
 
 $verboseDirectory
 
 $verboseDirectoryUrl
 
 $originalConf
 
 $originalConfig
 
 $originalConfigDirectories
 
 $originalContainer
 
 $originalFileDirectory = NULL
 
 $originalLanguage
 
 $originalPrefix
 
 $originalProfile
 
 $originalSessionName
 
 $originalSettings
 
 $originalShutdownCallbacks
 
 $originalSite
 
 $originalUser
 
 $publicFilesDirectory
 
 $privateFilesDirectory
 
 $tempFilesDirectory
 
 $translationFilesDirectory
 
 $kernel
 
 $container
 
 $configImporter
 
 $strictConfigSchema = TRUE
 
 $httpAuthMethod = CURLAUTH_BASIC
 
 $httpAuthCredentials = NULL
 

Additional Inherited Members

- Public Member Functions inherited from WebTestBase
 __construct ($test_id=NULL)
 
 drupalGetNodeByTitle ($title, $reset=FALSE)
 
- Public Member Functions inherited from TestBase
 __construct ($test_id=NULL)
 
 run (array $methods=array())
 
 errorHandler ($severity, $message, $file=NULL, $line=NULL)
 
 configImporter ()
 
 copyConfig (StorageInterface $source_storage, StorageInterface $target_storage)
 
 getDatabasePrefix ()
 
 getTempFilesDirectory ()
 
- Static Public Member Functions inherited from TestBase
static insertAssert ($test_id, $test_class, $status, $message= '', $group= 'Other', array $caller=array())
 
static deleteAssert ($message_id)
 
static getDatabaseConnection ()
 
static generatePermutations ($parameters)
 
static filePreDeleteCallback ($path)
 
- Data Fields inherited from WebTestBase
createRole as drupalCreateRole
 
createAdminRole as drupalCreateAdminRole
 
- Data Fields inherited from TestBase
 $results
 
 $verbose
 
 $dieOnFail = FALSE
 
- Static Protected Attributes inherited from TestBase
static $configSchemaCheckerExclusions
 

Detailed Description

Base class for testing updates to string translations.

Member Function Documentation

addLanguage (   $langcode)
protected

Adds a language.

Parameters
string$langcodeThe language code of the language to add.

References TestBase\assertTrue(), WebTestBase\drupalPostForm(), SafeMarkup\format(), Drupal\languageManager(), and t().

Referenced by LocaleUpdateCronTest\setUp(), LocaleUpdateTest\setUp(), and LocaleUpdateInterfaceTest\testInterface().

Here is the call graph for this function:

Here is the caller graph for this function:

assertTranslation (   $source,
  $translation,
  $langcode,
  $message = '' 
)
protected

Checks the translation of a string.

Parameters
string$sourceTranslation source string.
string$translationTranslation to check. Use empty string to check for a not existing translation.
string$langcodeLanguage code of the language to translate to.
string$message(optional) A message to display with the assertion.

References TestBase\assertEqual(), db_query(), and format_string().

Referenced by LocaleUpdateTest\testEnableLanguage(), LocaleUpdateTest\testEnableUninstallModule(), and LocaleUpdateTest\testUpdateImportModeNone().

Here is the call graph for this function:

Here is the caller graph for this function:

makePoFile (   $path,
  $filename,
  $timestamp = NULL,
array  $translations = array() 
)
protected

Creates a translation file and tests its timestamp.

Parameters
string$pathPath of the file relative to the public file path.
string$filenameName of the file to create.
int$timestamp(optional) Timestamp to set the file to. Defaults to current time.
array$translations(optional) Array of source/target value translation strings. Only singular strings are supported, no plurals. No double quotes are allowed in source and translations strings.

References drupal_realpath(), FILE_CREATE_DIRECTORY, file_prepare_directory(), and FILE_STATUS_PERMANENT.

Referenced by LocaleUpdateBase\setTranslationFiles().

Here is the call graph for this function:

Here is the caller graph for this function:

setCurrentTranslations ( )
protected

Setup existing translations in the database and set up the status of existing translations.

References db_insert().

Referenced by LocaleUpdateTest\testUpdateImportModeNonCustomized(), LocaleUpdateTest\testUpdateImportModeNone(), LocaleUpdateTest\testUpdateImportSourceLocal(), and LocaleUpdateTest\testUpdateImportSourceRemote().

Here is the call graph for this function:

Here is the caller graph for this function:

setTranslationFiles ( )
protected

Setup the environment containing local and remote translation files.

Update tests require a simulated environment for local and remote files. Normally remote files are located at a remote server (e.g. ftp.drupal.org). For testing we can not rely on this. A directory in the file system of the test site is designated for remote files and is addressed using an absolute URL. Because Drupal does not allow files with a po extension to be accessed (denied in .htaccess) the translation files get a _po extension. Another directory is designated for local translation files.

The environment is set up with the following files. File creation times are set to create different variations in test conditions. contrib_module_one

  • remote file: timestamp new
  • local file: timestamp old contrib_module_two
  • remote file: timestamp old
  • local file: timestamp new contrib_module_three
  • remote file: timestamp old
  • local file: timestamp old custom_module_one
  • local file: timestamp new Time stamp of current translation set by setCurrentTranslations() is always timestamp medium. This makes it easy to predict which translation will be imported.

References PublicStream\basePath(), TestBase\config(), LocaleUpdateBase\makePoFile(), LocaleUpdateBase\setTranslationsDirectory(), and Drupal\state().

Referenced by LocaleUpdateTest\testUpdateCheckStatus(), LocaleUpdateCronTest\testUpdateCron(), LocaleUpdateTest\testUpdateImportModeNonCustomized(), LocaleUpdateTest\testUpdateImportModeNone(), LocaleUpdateTest\testUpdateImportSourceLocal(), and LocaleUpdateTest\testUpdateImportSourceRemote().

Here is the call graph for this function:

Here is the caller graph for this function:

setTranslationsDirectory (   $path)
protected

Sets the value of the default translations directory.

Parameters
string$pathPath of the translations directory relative to the drupal installation directory.

References TestBase\config(), FILE_CREATE_DIRECTORY, and file_prepare_directory().

Referenced by LocaleUpdateBase\setTranslationFiles().

Here is the call graph for this function:

Here is the caller graph for this function:

setUp ( )
protected

{}

References TestBase\config().

Here is the call graph for this function:


The documentation for this class was generated from the following file: