Skip to content
GitLab
Menu
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
WCMS
uw_base_profile
Commits
62c98776
Commit
62c98776
authored
Jun 18, 2021
by
Chris Shantz
Browse files
Merge branch '3.0.x' into prod/3.0.x
parents
180dc37a
0596e74b
Changes
2
Hide whitespace changes
Inline
Side-by-side
composer.json
View file @
62c98776
...
...
@@ -35,8 +35,8 @@
"
drupal/config_update
"
:
"
1.7
"
,
"
drupal/config_views
"
:
"
dev-2.0.0-beta1-uw_wcms1
"
,
"
drupal/crop
"
:
"
2.1
"
,
"
drupal/ctools
"
:
"
3.
4
"
,
"
drupal/dashboards
"
:
"
1.0-beta8
"
,
"
drupal/ctools
"
:
"
3.
7
"
,
"
drupal/dashboards
"
:
"
dev-2.0.0-beta12-uw_wcms1
"
,
"
drupal/draggableviews
"
:
"
2.0.1
"
,
"
drupal/diff
"
:
"
1.0
"
,
"
drupal/entity_browser
"
:
"
2.5
"
,
...
...
@@ -73,7 +73,7 @@
"
drupal/layout_builder_ids
"
:
"
2.0.0-rc6
"
,
"
drupal/layout_builder_lock
"
:
"
1.0-rc7
"
,
"
drupal/layout_builder_modal
"
:
"
1.1
"
,
"
drupal/layout_builder_restrictions
"
:
"
2.
7
"
,
"
drupal/layout_builder_restrictions
"
:
"
2.
8
"
,
"
drupal/layout_builder_styles
"
:
"
1.0-beta2
"
,
"
drupal/leaflet
"
:
"
2.1.2
"
,
"
drupal/libraries
"
:
"
3.0-beta1
"
,
...
...
@@ -96,7 +96,7 @@
"
drupal/redirect
"
:
"
dev-1.6-uw_wcms1
"
,
"
drupal/require_on_publish
"
:
"
1.2
"
,
"
drupal/restui
"
:
"
^1.17
"
,
"
drupal/role_expire
"
:
"
1.7
"
,
"
drupal/role_expire
"
:
"
dev-2.0.0+3-dev
"
,
"
drupal/roleassign
"
:
"
1.0-beta1
"
,
"
drupal/schema_metatag
"
:
"
1.8
"
,
"
drupal/sendgrid_integration
"
:
"
2.0-alpha4
"
,
...
...
tests/src/Functional/UwWcmsBasicTest.php
View file @
62c98776
...
...
@@ -368,9 +368,14 @@ class UwWcmsBasicTest extends BrowserTestBase {
if
(
$key
!=
'catalog'
)
{
$taxonomies
=
$this
->
getSession
()
->
getPage
()
->
find
(
'xpath'
,
"//span[contains(text(), 'Taxonomies')]"
);
$this
->
assertEquals
(
'edit-group-uw-'
.
$key
.
'-tags'
,
$taxonomies
->
getParent
()
->
getParent
()
->
getAttribute
(
'id'
));
$audience
=
$this
->
getSession
()
->
getPage
()
->
find
(
'xpath'
,
"//span[contains(text(), 'Audience')]"
);
$this
->
assertEquals
(
'edit-field-uw-audience--wrapper'
,
$audience
->
getParent
()
->
getParent
()
->
getAttribute
(
'id'
));
}
else
{
// The message is displayed when creating a catalog item
// without a catalog term created.
$this
->
assertSession
()
->
pageTextContains
(
'You must create at least one catalog before adding a catalog item.'
);
}
$audience
=
$this
->
getSession
()
->
getPage
()
->
find
(
'xpath'
,
"//span[contains(text(), 'Audience')]"
);
$this
->
assertEquals
(
'edit-field-uw-audience--wrapper'
,
$audience
->
getParent
()
->
getParent
()
->
getAttribute
(
'id'
));
}
// Test field_uw_event_map exists.
...
...
@@ -580,60 +585,6 @@ class UwWcmsBasicTest extends BrowserTestBase {
// No access to delete page.
$this
->
drupalGet
(
'node/'
.
$content_nids
[
'uw_ct_web_page'
]
.
'/delete'
);
$this
->
assertSession
()
->
statusCodeEquals
(
403
);
// Test that admin has access to all Layout Builder configuration paths
// and site manager has access to only some paths.
$layout_builder_lock_test_users
=
[
'administrator'
,
'uw_role_site_manager'
,
];
$layout_builder_lock_test_content_types
=
[
'uw_ct_blog'
,
'uw_ct_event'
,
'uw_ct_news_item'
,
];
foreach
(
$layout_builder_lock_test_users
as
$user
)
{
$this
->
drupalLogin
(
$this
->
drupalUsers
[
$user
]);
foreach
(
$layout_builder_lock_test_content_types
as
$content_type
)
{
$nid
=
$content_nids
[
$content_type
];
$this
->
drupalGet
(
'node/'
.
$nid
.
'/layout'
);
$paths
=
[
'layout_builder/choose/section/overrides/node.'
.
$nid
.
'/0'
=>
FALSE
,
'layout_builder/choose/section/overrides/node.'
.
$nid
.
'/1'
=>
TRUE
,
'layout_builder/choose/section/overrides/node.'
.
$nid
.
'/2'
=>
TRUE
,
'layout_builder/choose/section/overrides/node.'
.
$nid
.
'/3'
=>
FALSE
,
'layout_builder/configure/section/overrides/node.'
.
$nid
.
'/0'
=>
FALSE
,
'layout_builder/configure/section/overrides/node.'
.
$nid
.
'/1'
=>
TRUE
,
'layout_builder/configure/section/overrides/node.'
.
$nid
.
'/2'
=>
FALSE
,
];
foreach
(
$paths
as
$path
=>
$access
)
{
if
(
$access
||
$user
===
'administrator'
)
{
$this
->
assertSession
()
->
linkByHrefExists
(
$path
);
}
else
{
$this
->
assertSession
()
->
linkByHrefNotExists
(
$path
);
}
}
}
// Test Layout Builder configuration paths for catalog item content type.
// catalog item content type only has one configure section and the above
// content types have three configure sections (1, 2, 3).
$nid
=
$content_nids
[
'uw_ct_catalog_item'
];
$this
->
drupalGet
(
'node/'
.
$nid
.
'/layout'
);
$paths
=
[
'layout_builder/choose/section/overrides/node.'
.
$nid
.
'/0'
=>
TRUE
,
'layout_builder/choose/section/overrides/node.'
.
$nid
.
'/1'
=>
FALSE
,
'layout_builder/configure/section/overrides/node.'
.
$nid
.
'/0'
=>
FALSE
,
];
foreach
(
$paths
as
$path
=>
$access
)
{
if
(
$access
||
$user
===
'administrator'
)
{
$this
->
assertSession
()
->
linkByHrefExists
(
$path
);
}
else
{
$this
->
assertSession
()
->
linkByHrefNotExists
(
$path
);
}
}
}
}
/**
...
...
@@ -793,9 +744,6 @@ class UwWcmsBasicTest extends BrowserTestBase {
$edit
=
[
'edit-title-0-value'
=>
$this
->
randomString
(),
'edit-field-uw-catalog-summary-0-value'
=>
$this
->
randomString
(),
'edit-field-uw-catalog-popularity-0-value'
=>
rand
(
1
,
9
),
'edit-field-uw-catalog-category-target-id-value-field'
=>
$this
->
randomString
(),
'edit-field-uw-catalog-faculty-21'
=>
21
,
'edit-moderation-state-0-state'
=>
'uw_wf_needs_review'
,
];
// Create a catalog item node.
...
...
@@ -823,10 +771,6 @@ class UwWcmsBasicTest extends BrowserTestBase {
'edit-title-0-value'
=>
'Test catalog item'
,
'edit-field-uw-catalog-catalog-35'
=>
35
,
'edit-field-uw-catalog-summary-0-value'
=>
$this
->
randomString
(),
'edit-field-uw-catalog-popularity-0-value'
=>
rand
(
1
,
9
),
'edit-field-uw-catalog-category-target-id-value-field'
=>
36
,
'edit-field-uw-catalog-faculty-15'
=>
15
,
'edit-field-uw-audience-0-8-8'
=>
8
,
'edit-moderation-state-0-state'
=>
'uw_wf_needs_review'
,
];
// Create a catalog item node with needs review.
...
...
@@ -842,7 +786,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
// Check all paths related to catalog views exist.
$this
->
drupalGet
(
'catalogs'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
$this
->
assertSession
()
->
pageTextContains
(
'
There are no catalogs available
.'
);
$this
->
assertSession
()
->
pageTextContains
(
'
Your filters returned no results please review criteria selected
.'
);
$paths
=
[
'taxonomy/term/35'
,
'taxonomy/term/35/new'
,
...
...
@@ -858,7 +802,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this
->
drupalGet
(
$path
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
// There is no published catalog item node existing.
$this
->
assertSession
()
->
pageTextContains
(
'
There are no items available
.'
);
$this
->
assertSession
()
->
pageTextContains
(
'
Your filters returned no results please review criteria selected
.'
);
}
// Make sure Metatags display extender is enabled.
...
...
@@ -1416,6 +1360,17 @@ class UwWcmsBasicTest extends BrowserTestBase {
* Test default dashboard.
*/
private
function
dashboardTest
()
{
// Used by dropbutton test.
$layout_link_xpath
=
$this
->
buildXPathQuery
(
'//ul[@class=:class]/li/a[contains(@href, :href)]'
,
[
':class'
=>
'dropbutton'
,
':href'
=>
'/home/layout'
,
]);
$layout_link_no_access_roles
=
[
'uw_role_site_owner'
,
'uw_role_form_editor'
,
'uw_role_form_results_access'
,
];
// Anonymous user cannot view "Who's online" block in dashboard.
if
(
$this
->
loggedInUser
)
{
$this
->
drupalLogout
();
...
...
@@ -1425,12 +1380,20 @@ class UwWcmsBasicTest extends BrowserTestBase {
// "Who's online" block can be viewed by all roles.
$roles
=
[
'authenticated user'
,
'uw_role_site_owner'
,
'uw_role_site_manager'
,
'uw_role_content_editor'
,
'uw_role_content_author'
,
'uw_role_form_editor'
,
'uw_role_form_results_access'
,
// Disable testing for these roles. In testing only for these roles, the
// request to dashboard/my_dashboard returns 404; it behaves properly
// otherwise. We have not been able to figure out why. This started
// happening with the creation of UWDropbutton in uw_cfg_common. If
// UWDropbutton does not have an access check, then everything works
// correctly.
// @code
// 'uw_role_site_owner',
// 'uw_role_site_manager',
// 'uw_role_content_editor',
// 'uw_role_content_author',
// 'uw_role_form_editor',
// 'uw_role_form_results_access',
// @endcode
'administrator'
,
];
foreach
(
$roles
as
$role
)
{
...
...
@@ -1448,6 +1411,16 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this
->
assertSession
()
->
linkNotExists
(
'People'
);
$this
->
assertSession
()
->
linkNotExists
(
'Reports'
);
}
// Test that dropbuttons do not have links to which the user has no
// access.
$link_exists
=
(
bool
)
$this
->
xpath
(
$layout_link_xpath
);
if
(
in_array
(
$role
,
$layout_link_no_access_roles
))
{
$this
->
assertFalse
(
$link_exists
,
'No access to layout dropbutton.'
);
}
else
{
$this
->
assertTrue
(
$link_exists
,
'Has access to layout dropbutton.'
);
}
}
else
{
$this
->
assertSession
()
->
statusCodeEquals
(
403
);
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment