Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[6.0] [SEF] Remove parent_key from url in NoMenuRules #44460

Open
wants to merge 7 commits into
base: 6.0-dev
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions libraries/src/Component/Router/Rules/NomenuRules.php
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,9 @@ public function build(&$query, &$segments)
}
} else {
$segments[] = str_replace(':', '-', array_pop($result));
if ($view->parent_key) {
unset($query[$view->parent_key]);
}
}
} else {
$segments[] = str_replace(':', '-', $query[$view->key]);
Expand Down
24 changes: 8 additions & 16 deletions tests/System/integration/site/components/com_contact/Router.cy.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,12 @@ describe('Test in frontend that the contact site router', () => {
cy.db_createContact({ name: 'Test Contact', alias: 'test-contact-router' }).then((contact) => {
const url = '/index.php/component/contact/contact/test-contact-router';
cy.request({ url: `/index.php?option=com_contact&view=contact&id=${contact.id}`, followRedirect: false }).then((response) => {
// @TODO: The following line is just a temporary fix. Remove it and uncomment the 2 lines after it when done.
expect(response.status).to.eq(200);
// expect(response.status).to.eq(301);
// expect(response.redirectedToUrl).to.match(new RegExp(`${url}$`));
expect(response.status).to.eq(301);
expect(response.redirectedToUrl).to.match(new RegExp(`${url}$`));
});
cy.request({ url: `/index.php?option=com_contact&view=contact&id=${contact.id}-${contact.alias}`, followRedirect: false }).then((response) => {
// @TODO: The following line is just a temporary fix. Remove it and uncomment the 2 lines after it when done.
expect(response.status).to.eq(200);
// expect(response.status).to.eq(301);
// expect(response.redirectedToUrl).to.match(new RegExp(`${url}$`));
expect(response.status).to.eq(301);
expect(response.redirectedToUrl).to.match(new RegExp(`${url}$`));
});

cy.visit(url);
Expand Down Expand Up @@ -168,16 +164,12 @@ describe('Test in frontend that the contact site router', () => {
expect(response.status).to.eq(200);
});
cy.request({ url: `/index.php?option=com_contact&view=contact&id=${contact.id}`, followRedirect: false }).then((response) => {
// @TODO: The following line is just a temporary fix. Remove it and uncomment the 2 lines after it when done.
expect(response.status).to.eq(200);
// expect(response.status).to.eq(301);
// expect(response.redirectedToUrl).to.match(new RegExp(`${url}$`));
expect(response.status).to.eq(301);
expect(response.redirectedToUrl).to.match(new RegExp(`${url}$`));
});
cy.request({ url: `/index.php?option=com_contact&view=contact&id=${contact.id}-${contact.alias}`, followRedirect: false }).then((response) => {
// @TODO: The following line is just a temporary fix. Remove it and uncomment the 2 lines after it when done.
expect(response.status).to.eq(200);
// expect(response.status).to.eq(301);
// expect(response.redirectedToUrl).to.match(new RegExp(`${url}$`));
expect(response.status).to.eq(301);
expect(response.redirectedToUrl).to.match(new RegExp(`${url}$`));
});
});
});
Expand Down