Drupal 8  8.0.2
MenuTest Class Reference
Inheritance diagram for MenuTest:

Public Member Functions

 addCustomMenuCRUD ()
 
 addCustomMenu ()
 
 deleteCustomMenu ()
 
 doMenuTests ()
 
 testMenuQueryAndFragment ()
 
 testSystemMenuRename ()
 
 testUnpublishedNodeMenuItem ()
 
 testBlockContextualLinks ()
 
 addMenuLink ($parent= '', $path= '/', $menu_name= 'tools', $expanded=FALSE, $weight= '0')
 
 addInvalidMenuLink ()
 
 checkInvalidParentMenuLinks ()
 
 verifyMenuLink (MenuLinkContent $item, $item_node, MenuLinkContent $parent=NULL, $parent_node=NULL)
 
 moveMenuLink (MenuLinkContent $item, $parent, $menu_name)
 
 modifyMenuLink (MenuLinkContent $item)
 
 resetMenuLink (MenuLinkInterface $menu_link, $old_weight)
 
 deleteMenuLink (MenuLinkContent $item)
 
 toggleMenuLink (MenuLinkContent $item)
 
 disableMenuLink (MenuLinkContent $item)
 
 enableMenuLink (MenuLinkContent $item)
 
 testMenuParentsJsAccess ()
 
- 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 Attributes

static $modules = array('node', 'block', 'contextual', 'help', 'path', 'test_page_test')
 
- Static Public Attributes inherited from MenuWebTestBase
static $modules = array('menu_ui', 'menu_link_content')
 

Protected Member Functions

 setUp ()
 
 doMenuLinkFormDefaultsTest ()
 
 doTestMenuBlock ()
 
- 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

 $adminUser
 
 $authenticatedUser
 
 $blockPlacements
 
 $menu
 
 $items
 
- 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

- 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

Add a custom menu, add menu links to the custom menu and Tools menu, check their data, and delete them using the UI.

menu_ui

Member Function Documentation

addCustomMenu ( )

Creates a custom menu.

Returns
The custom menu that has been created.

References WebTestBase\clickLinkPartialName(), TestBase\config(), WebTestBase\drupalGet(), WebTestBase\drupalPlaceBlock(), WebTestBase\drupalPostForm(), Entity\load(), Unicode\strlen(), and t().

Referenced by MenuTest\testBlockContextualLinks().

Here is the call graph for this function:

Here is the caller graph for this function:

addCustomMenuCRUD ( )

Adds a custom menu using CRUD functions.

References WebTestBase\drupalGet().

Here is the call graph for this function:

addInvalidMenuLink ( )

Attempts to add menu link with invalid path or no access permission.

References WebTestBase\drupalPostForm(), and t().

Here is the call graph for this function:

addMenuLink (   $parent = '',
  $path = '/',
  $menu_name = 'tools',
  $expanded = FALSE,
  $weight = '0' 
)

Adds a menu link using the UI.

Parameters
string$parentOptional parent menu link id.
string$pathThe path to enter on the form. Defaults to the front page.
string$menu_nameMenu name. Defaults to 'tools'.
bool$expandedWhether or not this menu link is expanded. Setting this to TRUE should test whether it works when we do the authenticatedUser tests. Defaults to FALSE.
string$weightMenu weight. Defaults to 0.
Returns
A menu link entity.

References WebTestBase\assertResponse(), TestBase\assertTrue(), WebTestBase\drupalGet(), WebTestBase\drupalPostForm(), and t().

Referenced by MenuTest\doMenuTests(), MenuTest\testBlockContextualLinks(), MenuTest\testMenuQueryAndFragment(), and MenuTest\testUnpublishedNodeMenuItem().

Here is the call graph for this function:

Here is the caller graph for this function:

checkInvalidParentMenuLinks ( )

Tests that parent options are limited by depth when adding menu links.

References WebTestBase\drupalGet(), WebTestBase\drupalPostForm(), Drupal\service(), and t().

Referenced by MenuTest\doMenuTests().

Here is the call graph for this function:

Here is the caller graph for this function:

deleteCustomMenu ( )

Deletes the locally stored custom menu.

This deletes the custom menu that is stored in $this->menu and performs tests on the menu delete user interface.

References TestBase\assertFalse(), TestBase\assertNull(), WebTestBase\assertResponse(), WebTestBase\drupalGet(), WebTestBase\drupalPostForm(), Entity\load(), and t().

Here is the call graph for this function:

deleteMenuLink ( MenuLinkContent  $item)

Deletes a menu link using the UI.

Parameters
\Drupal\menu_link_content\Entity\MenuLinkContent$itemMenu link.

References WebTestBase\assertResponse(), WebTestBase\drupalGet(), WebTestBase\drupalPostForm(), MenuLinkContent\getTitle(), ContentEntityBase\id(), and t().

Here is the call graph for this function:

disableMenuLink ( MenuLinkContent  $item)

Disables a menu link.

Parameters
\Drupal\menu_link_content\Entity\MenuLinkContent$itemMenu link.

References WebTestBase\drupalPostForm(), MenuLinkContent\getPluginId(), ContentEntityBase\id(), and t().

Referenced by MenuTest\doMenuTests(), and MenuTest\toggleMenuLink().

Here is the call graph for this function:

Here is the caller graph for this function:

doMenuLinkFormDefaultsTest ( )
protected

Ensures that the proper default values are set when adding a menu link

References WebTestBase\assertResponse(), and WebTestBase\drupalGet().

Referenced by MenuTest\doMenuTests().

Here is the call graph for this function:

Here is the caller graph for this function:

doTestMenuBlock ( )
protected

Tests menu block settings.

References TestBase\assertEqual(), WebTestBase\drupalGet(), WebTestBase\drupalPostForm(), Entity\load(), and t().

Here is the call graph for this function:

enableMenuLink ( MenuLinkContent  $item)

Enables a menu link.

Parameters
\Drupal\menu_link_content\Entity\MenuLinkContent$itemMenu link.

References WebTestBase\drupalPostForm(), MenuLinkContent\getPluginId(), ContentEntityBase\id(), and t().

Referenced by MenuTest\toggleMenuLink().

Here is the call graph for this function:

Here is the caller graph for this function:

modifyMenuLink ( MenuLinkContent  $item)

Modifies a menu link using the UI.

Parameters
\Drupal\menu_link_content\Entity\MenuLinkContent$itemMenu link entity.

References WebTestBase\assertResponse(), WebTestBase\drupalGet(), WebTestBase\drupalPostForm(), MenuLinkContent\getMenuName(), MenuLinkContent\getTitle(), ContentEntityBase\id(), and t().

Referenced by MenuTest\doMenuTests(), and MenuTest\testUnpublishedNodeMenuItem().

Here is the call graph for this function:

Here is the caller graph for this function:

moveMenuLink ( MenuLinkContent  $item,
  $parent,
  $menu_name 
)

Changes the parent of a menu link using the UI.

Parameters
\Drupal\menu_link_content\MenuLinkContentInterface$itemThe menu link item to move.
int$parentThe id of the new parent.
string$menu_nameThe menu the menu link will be moved to.

References WebTestBase\assertResponse(), WebTestBase\drupalPostForm(), ContentEntityBase\id(), and t().

Referenced by MenuTest\doMenuTests().

Here is the call graph for this function:

Here is the caller graph for this function:

resetMenuLink ( MenuLinkInterface  $menu_link,
  $old_weight 
)

Resets a standard menu link using the UI.

Parameters
\Drupal\Core\Menu\MenuLinkInterface$menu_linkThe Menu link.
int$old_weightOriginal title for menu link.

References TestBase\assertEqual(), WebTestBase\assertResponse(), WebTestBase\drupalPostForm(), PluginInspectionInterface\getPluginId(), Drupal\service(), and t().

Here is the call graph for this function:

testBlockContextualLinks ( )

Tests the contextual links on a menu block.

References MenuTest\addCustomMenu(), MenuTest\addMenuLink(), TestBase\assertIdentical(), WebTestBase\assertResponse(), Json\decode(), WebTestBase\drupalGet(), WebTestBase\drupalLogin(), WebTestBase\drupalPlaceBlock(), WebTestBase\drupalPost(), and format_string().

Here is the call graph for this function:

testMenuParentsJsAccess ( )

Tests if administrative users other than user 1 can access the menu parents AJAX callback.

References WebTestBase\assertResponse(), WebTestBase\drupalGetAjax(), and WebTestBase\drupalLogin().

Here is the call graph for this function:

testMenuQueryAndFragment ( )

Adds and removes a menu link with a query string and fragment.

References MenuTest\addMenuLink(), WebTestBase\drupalGet(), WebTestBase\drupalLogin(), WebTestBase\drupalPostForm(), and t().

Here is the call graph for this function:

testSystemMenuRename ( )

Tests renaming the built-in menu.

References WebTestBase\clickLinkPartialName(), TestBase\config(), WebTestBase\drupalLogin(), WebTestBase\drupalPostForm(), and t().

Here is the call graph for this function:

testUnpublishedNodeMenuItem ( )

Tests that menu items pointing to unpublished nodes are editable.

References MenuTest\addMenuLink(), WebTestBase\assertCacheContext(), WebTestBase\drupalCreateNode(), WebTestBase\drupalGet(), WebTestBase\drupalLogin(), WebTestBase\drupalLogout(), and MenuTest\modifyMenuLink().

Here is the call graph for this function:

toggleMenuLink ( MenuLinkContent  $item)

Alternately disables and enables a menu link.

Parameters
\Drupal\menu_link_content\Entity\MenuLinkContent$itemMenu link.

References MenuTest\disableMenuLink(), WebTestBase\drupalGet(), MenuTest\enableMenuLink(), and MenuLinkContent\getTitle().

Referenced by MenuTest\doMenuTests().

Here is the call graph for this function:

Here is the caller graph for this function:

verifyMenuLink ( MenuLinkContent  $item,
  $item_node,
MenuLinkContent  $parent = NULL,
  $parent_node = NULL 
)

Verifies a menu link using the UI.

Parameters
\Drupal\menu_link_content\Entity\MenuLinkContent$itemMenu link.
object$item_nodeMenu link content node.
\Drupal\menu_link_content\Entity\MenuLinkContent$parentParent menu link.
object$parent_nodeParent menu link content node.

References WebTestBase\assertResponse(), WebTestBase\clickLink(), WebTestBase\drupalGet(), MenuLinkContent\getTitle(), and t().

Referenced by MenuTest\doMenuTests().

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: