Commit 407636fb authored by Lily Yan's avatar Lily Yan
Browse files

ISTWCMS-4499 Change from parse_url() to base_path()

parent 0038fc9b
......@@ -733,55 +733,47 @@ class UwWcmsBasicTest extends BrowserTestBase {
// Go to content management menu links.
$this->drupalGet('admin/structure/menu/manage/uw-menu-content-management');
$this->assertSession()->statusCodeEquals(200);
// Get the path.
global $base_url;
$base_url_parts = parse_url($base_url);
// If Drupal is installed in the root, not subfolder like /fsdu1.
if (!isset($base_url_parts['path'])) {
$base_url_parts['path'] = '';
}
// Check content management menu links.
$content_links = [
$base_url_parts['path'] . '/admin/structure/types' => 'Content types',
$base_url_parts['path'] . '/node/add/uw_ct_blog' => 'Blog post',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_blog_tags/add' => 'Add blog tag',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_blog_tags/overview' => 'List blog tags',
$base_url_parts['path'] . '/node/add/uw_ct_catalog_item' => 'Catalog item',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_catalog_categories/add' => 'Add catalog category',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_catalogs/add' => 'Add catalog',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_catalog_categories/overview' => 'List catalog categories',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_catalogs/overview' => 'List catalogs',
$base_url_parts['path'] . '/node/add/uw_ct_event' => 'Event',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_tax_event_tags/add' => 'Add event tag',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_tax_event_type/add' => 'Add event type',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_tax_event_tags/overview' => 'List event tags',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_tax_event_type/overview' => 'List event types',
$base_url_parts['path'] . '/node/add/uw_ct_news_item' => 'News item',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_news_tags/add' => 'Add news tag',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_news_tags/overview' => 'List news tags',
$base_url_parts['path'] . '/node/add/uw_ct_site_footer' => 'Site footer',
$base_url_parts['path'] . '/node/add/uw_ct_web_page' => 'Web page',
$base_url_parts['path'] . '/admin/structure/webform' => 'Forms',
$base_url_parts['path'] . '/admin/structure/webform/add' => 'Form',
$base_url_parts['path'] . '/admin/structure/webform/submissions/manage' => 'Manage submissions',
$base_url_parts['path'] . '/admin/structure/taxonomy' => 'Global vocabularies',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_audience' => 'Audience',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_audience/add' => 'Add term',
$base_url_parts['path'] . '/admin/structure/taxonomy/manage/uw_vocab_audience/overview' => 'List terms',
'admin/structure/types' => 'Content types',
'node/add/uw_ct_blog' => 'Blog post',
'admin/structure/taxonomy/manage/uw_vocab_blog_tags/add' => 'Add blog tag',
'admin/structure/taxonomy/manage/uw_vocab_blog_tags/overview' => 'List blog tags',
'node/add/uw_ct_catalog_item' => 'Catalog item',
'admin/structure/taxonomy/manage/uw_vocab_catalog_categories/add' => 'Add catalog category',
'admin/structure/taxonomy/manage/uw_vocab_catalogs/add' => 'Add catalog',
'admin/structure/taxonomy/manage/uw_vocab_catalog_categories/overview' => 'List catalog categories',
'admin/structure/taxonomy/manage/uw_vocab_catalogs/overview' => 'List catalogs',
'node/add/uw_ct_event' => 'Event',
'admin/structure/taxonomy/manage/uw_tax_event_tags/add' => 'Add event tag',
'admin/structure/taxonomy/manage/uw_tax_event_type/add' => 'Add event type',
'admin/structure/taxonomy/manage/uw_tax_event_tags/overview' => 'List event tags',
'admin/structure/taxonomy/manage/uw_tax_event_type/overview' => 'List event types',
'node/add/uw_ct_news_item' => 'News item',
'admin/structure/taxonomy/manage/uw_vocab_news_tags/add' => 'Add news tag',
'admin/structure/taxonomy/manage/uw_vocab_news_tags/overview' => 'List news tags',
'node/add/uw_ct_site_footer' => 'Site footer',
'node/add/uw_ct_web_page' => 'Web page',
'admin/structure/webform' => 'Forms',
'admin/structure/webform/add' => 'Form',
'admin/structure/webform/submissions/manage' => 'Manage submissions',
'admin/structure/taxonomy' => 'Global vocabularies',
'admin/structure/taxonomy/manage/uw_vocab_audience' => 'Audience',
'admin/structure/taxonomy/manage/uw_vocab_audience/add' => 'Add term',
'admin/structure/taxonomy/manage/uw_vocab_audience/overview' => 'List terms',
];
foreach ($content_links as $key => $item) {
$this->assertSession()->linkExists($item);
$this->assertEquals($key, $this->getSession()->getPage()->findLink($item)->getAttribute('href'));
$this->assertEquals(base_path() . $key, $this->getSession()->getPage()->findLink($item)->getAttribute('href'));
}
// Go to site information menu links.
$this->drupalGet('admin/structure/menu/manage/uw-menu-site-management');
$this->assertSession()->statusCodeEquals(200);
// Check site information menu links.
$site_links = [
$base_url_parts['path'] . '/admin/content-access' => 'Content access',
$base_url_parts['path'] . '/admin/structure/menu' => 'Menus',
base_path() . 'admin/content-access' => 'Content access',
base_path() . 'admin/structure/menu' => 'Menus',
'mailto:rt-ist-wcms@rt.uwaterloo.ca' => 'Submit request',
'https://uwaterloo.ca/web-resources/wcms-users/training-and-support/wcms-how-documents' => 'WCMS how-to documents',
];
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment