Drupal 8  8.0.2
ViewTestBase Class Reference

Inherits WebTestBase.

Inherited by DisplayBlockTest, BlockContentTestBase, RevisionRelationshipsTest, CommentTestBase, DefaultViewRecentCommentsTest, ContactFieldsTest, ContactLinkTest, FieldTestBase, RelationshipUserFileDataTest, ForumIntegrationTest, HistoryTimestampTest, RelationshipUserImageDataTest, FrontPageTest, NodeTestBase, RevisionRelationshipsTest, IntegrationTest, TaxonomyFieldFilterTest, TaxonomyTestBase, TrackerTestBase, FilterPermissionUiTest, HandlerFilterUserNameTest, UserChangedTest, UserTestBase, DefaultViewsTest, BaseFieldAccessTest, FieldEntityTest, FieldEntityTranslationTest, FilterEntityBundleTest, GlossaryTest, AreaTitleWebTest, FieldGroupRowsWebTest, HandlerTest, HandlerTestBase, ExposedFormTest, MenuLinkTest, NumericFormatPluralTest, PluginTestBase, StyleSummaryTest, StyleTest, SearchIntegrationTest, SearchMultilingualTest, ViewAjaxTest, ViewElementTest, ViewRenderTest, ViewsEscapingTest, ViewsTemplateTest, ViewsThemeIntegrationTest, WizardTestBase, AnalyzeTest, FilterUITest, UITestBase, and UnsavedPreviewTest.

Static Public Attributes

static $modules = array('views', 'views_test_config')
 

Protected Member Functions

 setUp ($import_test_views=TRUE)
 
 enableViewsTestModule ()
 
 orderResultSet ($result_set, $column, $reverse=FALSE)
 
 helperButtonHasLabel ($id, $expected_label, $message= 'Label has the expected value:%label.')
 
 executeView (ViewExecutable $view, $args=array())
 
 schemaDefinition ()
 
 viewsData ()
 
 dataSet ()
 
- 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 ()
 

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
 
- 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
 
- Static Protected Attributes inherited from TestBase
static $configSchemaCheckerExclusions
 

Detailed Description

Defines a base class for Views testing in the full web test environment.

Use this base test class if you need to emulate a full Drupal installation. When possible, ViewKernelTestBase should be used instead. Both base classes include the same methods.

See Also

Member Function Documentation

dataSet ( )
protected

Returns a very simple test dataset.

References ViewTestData\dataSet().

Referenced by ViewTestBase\enableViewsTestModule(), StyleTableTest\testNumericFieldVisible(), and ViewsThemeIntegrationTest\testThemedViewPage().

Here is the call graph for this function:

Here is the caller graph for this function:

enableViewsTestModule ( )
protected

Sets up the views_test_data.module.

Because the schema of views_test_data.module is dependent on the test using it, it cannot be enabled normally.

References ViewTestBase\dataSet(), db_insert(), WebTestBase\rebuildContainer(), WebTestBase\resetAll(), ViewTestBase\schemaDefinition(), Drupal\service(), Drupal\state(), and ViewTestBase\viewsData().

Referenced by StyleTableTest\setUp(), ViewsSqlExceptionTest\setUp(), ViewsTemplateTest\setUp(), AreaTitleWebTest\setUp(), StyleOpmlTest\setUp(), StyleGridTest\setUp(), FilterUITest\setUp(), ViewsEscapingTest\setUp(), DisplayPageWebTest\setUp(), UITestBase\setUp(), ViewsThemeIntegrationTest\setUp(), CacheWebTest\setUp(), MenuLinkTest\setUp(), and AccessTestBase\setUp().

Here is the call graph for this function:

Here is the caller graph for this function:

executeView ( ViewExecutable  $view,
  $args = array() 
)
protected

Executes a view with debugging.

Parameters
\Drupal\views\ViewExecutable$viewThe view object.
array$args(optional) An array of the view arguments to use for the view.

References ViewExecutable\execute(), ViewExecutable\preExecute(), ViewExecutable\setDisplay(), and TestBase\verbose().

Referenced by FilterDateTimeTest\_testBetween(), FilterDateTimeTest\_testExact(), HandlerFieldFieldTest\_testFormatterSimpleFieldRender(), StyleTest\_testGrouping(), FilterDateTimeTest\_testOffset(), StyleGridTest\assertGrid(), TaxonomyTermFilterDepthTest\assertTermWithDepthResult(), DefaultViewsTest\testArchiveView(), ArgumentDefaultTest\testArgumentDefaultPlugin(), HandlerArgumentUserUidTest\testArgumentTitle(), ArgumentValidateTest\testArgumentValidateUserName(), ArgumentValidateTest\testArgumentValidateUserUid(), RevisionRelationshipsTest\testBlockContentRevisionRelationship(), DefaultViewRecentCommentsTest\testBlockDisplay(), CustomBooleanTest\testCustomOption(), CustomBooleanTest\testCustomOptionTemplate(), UserDataTest\testDataField(), FilterDateTest\testDateOffsets(), ArgumentDateTimeTest\testDatetimeArgumentAll(), ArgumentDateTimeTest\testDatetimeArgumentDay(), ArgumentDateTimeTest\testDatetimeArgumentMonth(), ArgumentDateTimeTest\testDatetimeArgumentYear(), SortDateTimeTest\testDateTimeSort(), ExposedFormTest\testExposedFormRender(), StyleSerializerTest\testFieldapiField(), StyleSerializerTest\testFieldRawOutput(), FilterUidRevisionTest\testFilter(), FilterEntityBundleTest\testFilterEntity(), FilterTest\testFilterQuery(), ForumIntegrationTest\testForumIntegration(), FrontPageTest\testFrontPage(), FieldEntityTest\testGetEntity(), ArgumentStringTest\testGlossary(), HistoryTimestampTest\testHandlers(), PagerTest\testLimit(), MiniPagerTest\testMiniPagerRender(), RevisionRelationshipsTest\testNodeRevisionRelationship(), PagerTest\testNoLimit(), PagerTest\testNormalPager(), DisplayTest\testOutputIsEmpty(), RelationshipRepresentativeNodeTest\testRelationship(), PagerTest\testRenderNullPager(), ViewsSqlExceptionTest\testSqlException(), TermNameFieldTest\testTermNameField(), TaxonomyTermFilterDepthTest\testTermWithDepthFilter(), StyleSerializerTest\testUIFieldAlias(), HandlerFilterUserNameTest\testUserNameApi(), TrackerUserUidTest\testUserUid(), TaxonomyFieldAllTermsTest\testViewsHandlerAllTermsField(), RelationshipUserFileDataTest\testViewsHandlerRelationshipUserFileData(), and RelationshipUserImageDataTest\testViewsHandlerRelationshipUserImageData().

Here is the call graph for this function:

helperButtonHasLabel (   $id,
  $expected_label,
  $message = 'Label has the expected value: %label.' 
)
protected

Asserts the existence of a button with a certain ID and label.

Parameters
string$idThe HTML ID of the button
string$label,.The expected label for the button.
string$message(optional) A custom message to display with the assertion. If no custom message is provided, the message will indicate the button label.
Returns
bool TRUE if the assertion was successful, or FALSE on failure.

References t().

Referenced by ExposedFormUITest\testExposedAdminUi(), ExposedFormTest\testInputRequired(), ExposedFormTest\testResetButton(), and ExposedFormTest\testSubmitButton().

Here is the call graph for this function:

Here is the caller graph for this function:

orderResultSet (   $result_set,
  $column,
  $reverse = FALSE 
)
protected

Orders a nested array containing a result set based on a given column.

Parameters
array$result_setAn array of rows from a result set, with each row as an associative array keyed by column name.
string$columnThe column name by which to sort the result set.
bool$reverse(optional) Boolean indicating whether to sort the result set in reverse order. Defaults to FALSE.
Returns
array The sorted result set.
schemaDefinition ( )
protected

Returns the schema definition.

References ViewTestData\schemaDefinition().

Referenced by ViewTestBase\enableViewsTestModule().

Here is the call graph for this function:

Here is the caller graph for this function:

viewsData ( )
protected

Returns the views data definition.

References ViewTestData\viewsData().

Referenced by ViewTestBase\enableViewsTestModule().

Here is the call graph for this function:

Here is the caller graph for this function:


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