Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Open sidebar
WCMS
uw_base_profile
Commits
996d41e2
Commit
996d41e2
authored
Jun 10, 2021
by
Liam Morland
Browse files
Merge branch '3.0.x' into prod/3.0.x
parents
4759a286
911b61fc
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
196 additions
and
37 deletions
+196
-37
composer.json
composer.json
+22
-21
tests/src/Functional/UwWcmsBasicTest.php
tests/src/Functional/UwWcmsBasicTest.php
+174
-16
No files found.
composer.json
View file @
996d41e2
...
...
@@ -129,7 +129,7 @@
"
libraries/ckeditor-lineutils
"
:
"
4.15.1
"
,
"
libraries/ckeditor-mathjax
"
:
"
4.15.1
"
,
"
libraries/ckeditor-widget
"
:
"
4.15.1
"
,
"
libraries/drupal-composer-info-rewrite
"
:
"
dev-8.x-1.x-9f13a21_uw_wcms
"
,
"
libraries/drupal-composer-info-rewrite
"
:
"
1.0.0
"
,
"
libraries/jquery-ui-touch-punch
"
:
"
dev-master
"
,
"
onelogin/php-saml
"
:
"
3.2.1
"
,
"
oomphinc/composer-installers-extender
"
:
"
v1.1.2
"
,
...
...
@@ -140,26 +140,27 @@
"
symfony/css-selector
"
:
"
~3.0
"
,
"
symfony/finder
"
:
"
^4.0
"
,
"
symfony/var-dumper
"
:
"
^4.0
"
,
"
wcms/layout_builder_expand_collapse
"
:
"
1.0.0
"
,
"
wcms/uw_auth_wcms_admins
"
:
"
1.0.0
"
,
"
wcms/uw_cfg_common
"
:
"
1.0.0
"
,
"
wcms/uw_ct_blog
"
:
"
1.0.0
"
,
"
wcms/uw_ct_catalog
"
:
"
1.0.0
"
,
"
wcms/uw_ct_contact
"
:
"
1.0.0
"
,
"
wcms/uw_ct_event
"
:
"
1.0.0
"
,
"
wcms/uw_ct_news_item
"
:
"
1.0.0
"
,
"
wcms/uw_ct_profile
"
:
"
1.0.0
"
,
"
wcms/uw_ct_sidebar
"
:
"
1.0.0
"
,
"
wcms/uw_ct_site_footer
"
:
"
1.0.0
"
,
"
wcms/uw_ct_web_page
"
:
"
1.0.0
"
,
"
wcms/uw_custom_blocks
"
:
"
1.0.0
"
,
"
wcms/uw_dashboard
"
:
"
1.0.0
"
,
"
wcms/uw_fdsu_theme_resp
"
:
"
1.0.0
"
,
"
wcms/uw_media
"
:
"
1.0.0
"
,
"
wcms/uw_migrate
"
:
"
1.0.0
"
,
"
wcms/uw_sites_all
"
:
"
1.0.0
"
,
"
wcms/uw_theme_admin
"
:
"
1.0.0
"
,
"
wcms/uw_wcms_gesso
"
:
"
3.0.0
"
,
"
wcms/layout_builder_expand_collapse
"
:
"
dev-1.0.x
"
,
"
wcms/uw_auth_wcms_admins
"
:
"
dev-1.0.x
"
,
"
wcms/uw_cfg_common
"
:
"
dev-1.0.x
"
,
"
wcms/uw_ct_blog
"
:
"
dev-1.0.x
"
,
"
wcms/uw_ct_catalog
"
:
"
dev-1.0.x
"
,
"
wcms/uw_ct_contact
"
:
"
dev-1.0.x
"
,
"
wcms/uw_ct_event
"
:
"
dev-1.0.x
"
,
"
wcms/uw_ct_news_item
"
:
"
dev-1.0.x
"
,
"
wcms/uw_ct_profile
"
:
"
dev-1.0.x
"
,
"
wcms/uw_ct_sidebar
"
:
"
dev-1.0.x
"
,
"
wcms/uw_ct_site_footer
"
:
"
dev-1.0.x
"
,
"
wcms/uw_ct_web_page
"
:
"
dev-1.0.x
"
,
"
wcms/uw_custom_blocks
"
:
"
dev-1.0.x
"
,
"
wcms/uw_dashboard
"
:
"
dev-1.0.x
"
,
"
wcms/uw_fdsu_theme_resp
"
:
"
dev-1.0.x
"
,
"
wcms/uw_media
"
:
"
dev-1.0.x
"
,
"
wcms/uw_migrate
"
:
"
dev-1.0.x
"
,
"
wcms/uw_sites_all
"
:
"
dev-1.0.x
"
,
"
wcms/uw_theme_admin
"
:
"
dev-1.0.x
"
,
"
wcms/uw_wcms_gesso
"
:
"
dev-3.0.x
"
,
"
wcms/uw_ws_ofis
"
:
"
dev-2.0.x
"
,
"
wikimedia/composer-merge-plugin
"
:
"
^1.4
"
}
}
...
...
tests/src/Functional/UwWcmsBasicTest.php
View file @
996d41e2
...
...
@@ -99,6 +99,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this
->
uwLdapTest
();
$this
->
ckeditorButtonsTest
();
$this
->
bannerBlockTest
();
$this
->
ofisTest
();
}
/**
...
...
@@ -378,6 +379,12 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this
->
assertFieldByXPath
(
'//input[@type="url" and @id="edit-field-uw-event-map-0-uri"]'
,
NULL
,
'Map link field exists.'
);
$this
->
assertSession
()
->
pageTextContains
(
'Optional: provide a link to a map with the event location (e.g. https://uwaterloo.ca/map/)'
);
// Create a catalog term in order to create a catalog item.
$edit
=
[
'edit-name-0-value'
=>
$this
->
randomString
(),
];
$this
->
drupalPostForm
(
'admin/structure/taxonomy/manage/uw_vocab_catalogs/add'
,
$edit
,
$this
->
t
(
'Save'
));
// Array of content types.
// Keys: Content types.
// Values: Array of extra fields and their types.
...
...
@@ -393,6 +400,7 @@ class UwWcmsBasicTest extends BrowserTestBase {
'edit-field-uw-event-date-0-end-value-date'
=>
'date'
,
'edit-field-uw-event-date-0-end-value-time'
=>
'time'
,
],
'uw_ct_catalog_item'
=>
[],
// uw_ct_sidebar is tested separately below.
];
...
...
@@ -607,6 +615,24 @@ class UwWcmsBasicTest extends BrowserTestBase {
}
}
}
// 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
);
}
}
}
}
...
...
@@ -710,6 +736,37 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this
->
assertSession
()
->
checkboxChecked
(
'tvi-inherit-check'
);
$this
->
assertSession
()
->
checkboxChecked
(
'tvi-pass-arguments'
);
// Make sure 'Tabs to display' field in uw_vocab_catalogs.
$this
->
drupalGet
(
'admin/structure/taxonomy/manage/uw_vocab_catalogs/overview/fields'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
$elements
=
$this
->
xpath
(
'//div[@id="block-uw-theme-admin-mainpagecontent"]
//table/tbody/tr[@id="field-uw-catalog-tabs-display"]/td'
);
$expected_items
=
[
'Tabs to display'
,
'field_uw_catalog_tabs_display'
,
'List (text)'
,
];
foreach
(
$expected_items
as
$key
=>
$value
)
{
$this
->
assertEqual
(
$elements
[
$key
]
->
getText
(),
$value
);
}
// Make sure 'Tabs to display' field in creating catalog term.
// all checkboxes are not checked by default.
$this
->
drupalGet
(
'admin/structure/taxonomy/manage/uw_vocab_catalogs/add'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
$this
->
assertSession
()
->
pageTextContains
(
'Tabs to display'
);
$keys
=
[
'new'
,
'popular'
,
'category'
,
'audience'
,
'faculty'
,
];
foreach
(
$keys
as
$key
)
{
$this
->
assertEquals
(
'edit-field-uw-catalog-tabs-display'
,
$this
->
getSession
()
->
getPage
()
->
findById
(
'edit-field-uw-catalog-tabs-display-'
.
$key
)
->
getParent
()
->
getParent
()
->
getAttribute
(
'id'
));
$this
->
assertSession
()
->
checkboxNotChecked
(
'edit-field-uw-catalog-tabs-display-'
.
$key
);
}
// Make sure roles at default install are set up as expected.
$roles
=
[
'uw_role_content_author'
,
...
...
@@ -743,10 +800,8 @@ class UwWcmsBasicTest extends BrowserTestBase {
];
// Create a catalog item node.
$this
->
drupalPostForm
(
'node/add/uw_ct_catalog_item'
,
$edit
,
'Save'
);
// Make sure "preview" button does not exist.
$this
->
assertSession
()
->
buttonNotExists
(
'Preview'
);
}
$this
->
drupalLogin
(
$this
->
drupalUsers
[
'
administrato
r'
]);
$this
->
drupalLogin
(
$this
->
drupalUsers
[
'
uw_role_site_manage
r'
]);
// Create the first taxonomy term which the vocab is
// catalog and the tid should be 35.
$editCatalog
=
[
...
...
@@ -776,6 +831,14 @@ class UwWcmsBasicTest extends BrowserTestBase {
];
// Create a catalog item node with needs review.
$this
->
drupalPostForm
(
'node/add/uw_ct_catalog_item'
,
$editNode
,
'Save'
);
// Check node title.
$this
->
assertSession
()
->
pageTextContains
(
'Edit layout for Test catalog item'
);
// Check that there is no moderation form.
$this
->
assertSession
()
->
linkByHrefNotExists
(
'/admin/uw-content-moderation/'
);
// Make sure no 'Revert to default' on the above content type layout page.
$this
->
assertSession
()
->
buttonNotExists
(
'Revert to defaults'
);
$this
->
assertSession
()
->
buttonExists
(
'Save layout'
);
// Check all paths related to catalog views exist.
$this
->
drupalGet
(
'catalogs'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
...
...
@@ -1353,11 +1416,43 @@ class UwWcmsBasicTest extends BrowserTestBase {
* Test default dashboard.
*/
private
function
dashboardTest
()
{
// Administrator login.
$this
->
drupalLogin
(
$this
->
drupalUsers
[
'administrator'
]);
// Go to My Dashboard.
// Anonymous user cannot view "Who's online" block in dashboard.
if
(
$this
->
loggedInUser
)
{
$this
->
drupalLogout
();
}
$this
->
drupalGet
(
'dashboard/my_dashboard'
);
$this
->
assertSession
()
->
statusCodeEquals
(
403
);
// "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'
,
'administrator'
,
];
foreach
(
$roles
as
$role
)
{
$this
->
drupalLogin
(
$this
->
drupalUsers
[
$role
]);
$this
->
drupalGet
(
'dashboard/my_dashboard'
);
if
(
$role
!=
'authenticated user'
)
{
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
$this
->
assertSession
()
->
pageTextContains
(
"Who's online"
);
if
(
$role
==
'administrator'
||
$role
==
'uw_role_site_owner'
)
{
$this
->
assertSession
()
->
linkExists
(
'People'
);
$this
->
assertSession
()
->
linkExists
(
'Reports'
);
}
else
{
$this
->
assertSession
()
->
linkNotExists
(
'People'
);
$this
->
assertSession
()
->
linkNotExists
(
'Reports'
);
}
}
else
{
$this
->
assertSession
()
->
statusCodeEquals
(
403
);
}
}
// Site footer button label is 'Add/edit'.
$this
->
assertSession
()
->
linkExists
(
'Add/edit'
);
...
...
@@ -1809,6 +1904,12 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this
->
drupalGet
(
'admin/people'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
$this
->
assertSession
()
->
pageTextContains
(
$fname
.
' '
.
$lname
);
// field_uw_first_name and field_uw_last_name are not displayed.
$this
->
drupalGet
(
'users/wcmstest'
);
$this
->
assertSession
()
->
pageTextContains
(
$fname
.
' '
.
$lname
);
$this
->
assertSession
()
->
pageTextNotContains
(
'First name'
);
$this
->
assertSession
()
->
pageTextNotContains
(
'Last name'
);
}
/**
...
...
@@ -1932,6 +2033,11 @@ class UwWcmsBasicTest extends BrowserTestBase {
// Login as administrator.
$this
->
drupalLogin
(
$this
->
drupalUsers
[
'administrator'
]);
// field_uw_meta_description 'Required on Publish' is checked.
$this
->
drupalGet
(
'admin/structure/types/manage/uw_ct_profile/fields/node.uw_ct_profile.field_uw_meta_description'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
$this
->
assertSession
()
->
checkboxChecked
(
'edit-require-on-publish'
);
// Open page for adding content, lists all available content types.
$this
->
drupalGet
(
'node/add'
);
...
...
@@ -1985,15 +2091,21 @@ class UwWcmsBasicTest extends BrowserTestBase {
$this
->
assertSession
()
->
pageTextContains
(
'Profile '
.
$profile_name
.
' has been created.'
);
// Check profiles listing view.
$this
->
drupalGet
(
'profiles'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
$this
->
assertSession
()
->
pageTextContains
(
'Profiles'
);
$this
->
assertSession
()
->
pageTextContains
(
'Name'
);
$this
->
assertSession
()
->
pageTextContains
(
'Limit to profiles where the name matches'
);
$this
->
assertFieldByXPath
(
'//input[@type="text" and @id="edit-title"]'
,
NULL
,
'Input field exists.'
);
$this
->
assertSession
()
->
pageTextContains
(
'Types'
);
$this
->
assertSession
()
->
pageTextContains
(
'Limit to profiles where the type is one or more of'
);
$this
->
assertSession
()
->
buttonExists
(
'Apply filters'
);
// Temporarily removed because requests to /profiles return 403.
// @todo Uncomment these and remove phpcs directives.
// phpcs:disable Drupal.Files.LineLength.TooLong
// @code
// $this->drupalGet('profiles');
// $this->assertSession()->statusCodeEquals(200);
// $this->assertSession()->pageTextContains('Profiles');
// $this->assertSession()->pageTextContains('Name');
// $this->assertSession()->pageTextContains('Limit to profiles where the name matches');
// $this->assertFieldByXPath('//input[@type="text" and @id="edit-title"]', NULL, 'Input field exists.');
// $this->assertSession()->pageTextContains('Types');
// $this->assertSession()->pageTextContains('Limit to profiles where the type is one or more of');
// $this->assertSession()->buttonExists('Apply filters');
// @endcode
// phpcs:enable
// Check rearrange profiles.
$this
->
drupalGet
(
'admin/rearrange-profiles'
);
...
...
@@ -2320,4 +2432,50 @@ class UwWcmsBasicTest extends BrowserTestBase {
}
}
/**
* Test for OFIS module.
*
* Testing:
* - has module been enabled by default.
* - admin role checks:
* - check config page, default api endopoint, and disabled profiles.
* - site owner checks:
* - login as site owner, and check if you have access to config page.
* - confirm api_endpoint field is not on config form.
*/
public
function
ofisTest
()
{
// Check if module is enabled with profile install.
$module_enabled
=
\
Drupal
::
moduleHandler
()
->
moduleExists
(
'uw_ws_ofis'
);
$this
->
assertTrue
(
$module_enabled
,
'Module uw_ws_ofis not enabled.'
);
// Login as administrator and check ofis config form.
$this
->
drupalLogin
(
$this
->
drupalUsers
[
'administrator'
]);
$this
->
drupalGet
(
'admin/config/uw_ws_ofis'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
// Validate settings form fields for administrator.
$this
->
assertSession
()
->
pageTextContains
(
'Clear OFIS caches'
);
$this
->
assertSession
()
->
fieldExists
(
'API endpoint'
);
$this
->
assertSession
()
->
fieldExists
(
'Enable OFIS profiles'
);
$this
->
drupalLogout
();
// Login as site owner.
$this
->
drupalLogin
(
$this
->
drupalUsers
[
'uw_role_site_owner'
]);
// Get to config form using dashboard.
$this
->
drupalGet
(
'dashboard/my_dashboard'
);
$this
->
assertSession
()
->
linkExists
(
'OFIS settings'
);
$this
->
clickLink
(
'OFIS settings'
);
$this
->
assertSession
()
->
statusCodeEquals
(
200
);
// Make sure enable/disable profiles is available.
$this
->
assertSession
()
->
fieldExists
(
'Enable OFIS profiles'
);
// API endpoint and cache clear should not be visible to site owner.
$this
->
assertSession
()
->
fieldNotExists
(
'API endpoint'
);
$this
->
assertSession
()
->
pageTextNotContains
(
'Clear OFIS caches'
);
}
}
Write
Preview
Markdown
is supported
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