Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
drupal_cms
Manage
Activity
Members
Labels
Plan
Wiki
Custom issue tracker
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Model registry
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
project
drupal_cms
Commits
e2a6e4af
Commit
e2a6e4af
authored
3 months ago
by
Adam G-H
Browse files
Options
Downloads
Patches
Plain Diff
Make the test a little more direct
parent
375c3dec
No related branches found
No related tags found
No related merge requests found
Checking pipeline status
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
recipes/drupal_cms_seo_tools/tests/src/Functional/ComponentValidationTest.php
+16
-40
16 additions, 40 deletions
...eo_tools/tests/src/Functional/ComponentValidationTest.php
with
16 additions
and
40 deletions
recipes/drupal_cms_seo_tools/tests/src/Functional/ComponentValidationTest.php
+
16
−
40
View file @
e2a6e4af
...
...
@@ -54,52 +54,28 @@ class ComponentValidationTest extends BrowserTestBase {
}
/**
* Checks the sitemap is accessible.
* Checks
that
the sitemap is accessible
and contains the expected links
.
*/
private
function
checkSitemap
():
void
{
$this
->
drupalGet
(
'/sitemap'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
$this
->
assertSession
()
->
linkByHrefNotExists
(
'/rss.xml'
);
}
/**
* Tests sitemap plugins enabled by default.
*/
public
function
testSitemapPluginsEnabledByDefault
():
void
{
$dir
=
realpath
(
__DIR__
.
'/../../..'
);
// The recipe should apply cleanly.
$this
->
applyRecipe
(
$dir
);
// Visit the sitemap configuration page.
// Grant permission to access sitemap configuration page.
$admin_user
=
$this
->
drupalCreateUser
([
'administer sitemap'
]);
$this
->
drupalLogin
(
$admin_user
);
// Visit the sitemap configuration page.
$this
->
drupalGet
(
'/admin/config/search/sitemap'
);
// Check that the Menu: Main navigation plugin is enabled.
$this
->
assertSession
()
->
checkboxChecked
(
'edit-plugins-menumain-enabled'
);
// Check that the Frontpage plugin is enabled.
$this
->
assertSession
()
->
checkboxChecked
(
'edit-plugins-frontpage-enabled'
);
// Add a menu link to the Main navigation menu.
MenuLinkContent
::
create
([
'title'
=>
'Test Link'
,
'link'
=>
[
'uri'
=>
'internal:/node/1'
],
// Create a main menu link to ensure it shows up in the site map.
$node
=
$this
->
drupalCreateNode
([
'type'
=>
'test'
]);
$menu_link
=
MenuLinkContent
::
create
([
'title'
=>
$node
->
getTitle
(),
'link'
=>
'internal:'
.
$node
->
toUrl
()
->
toString
(),
'menu_name'
=>
'main'
,
'weight'
=>
0
,
])
->
save
();
]);
$menu_link
->
save
();
// Visit the sitemap page.
$this
->
drupalGet
(
'/sitemap'
);
// Check that both plugins' items are present in the sitemap.
$this
->
assertSession
()
->
elementExists
(
'css'
,
'.sitemap-item.sitemap-plugin--menu'
);
$this
->
assertSession
()
->
elementExists
(
'css'
,
'.sitemap-item.sitemap-plugin--frontpage'
);
$assert_session
=
$this
->
assertSession
();
$assert_session
->
statusCodeEquals
(
200
);
$assert_session
->
linkByHrefNotExists
(
'/rss.xml'
);
$site_map
=
$assert_session
->
elementExists
(
'css'
,
'.sitemap'
);
$site_name
=
$this
->
config
(
'system.site'
)
->
get
(
'name'
);
$this
->
assertTrue
(
$site_map
->
hasLink
(
"Front page of
$site_name
"
),
'Front page link does not appear in the site map.'
);
$this
->
assertTrue
(
$site_map
->
hasLink
(
$menu_link
->
label
()),
'Main menu links do not appear in the site map.'
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment