User tests: Successful: Unsuccessful:
Fix newsfeed html view as down-merge from 5.1-dev. This follows #43879 and is extracted from and pre-condition for #43722 to use joomla-cypress 1.1.1 in 4.4-dev.
The warning is displayed in A) the frontenend view and B) the System Test (with a speaking checkForPhpNoticesOrWarnings
). Verify the warning before patching. After patching, check that there are no more warnings.
/index.php?option=com_newsfeeds&view=newsfeed&id=1
(ID comes from new created news feed) shows the PHP Warning message:As preparation for the Cypress System Test install speaking checkForPhpNoticesOrWarnings
in overwriting lines 74 ... 89 in node_modules/joomla-cypress/src/support.js
with the following lines:
Cypress.Commands.add('checkForPhpNoticesOrWarnings', () => {
cy.log('**Check for PHP notices and warnings**')
cy.document().then((doc) => {
const pageSource = doc.documentElement.innerHTML
// Search for PHP problem keywords in bold style with colon and collect the found keyword and the message
const regex = /<b>(Warning|Deprecated|Notice|Strict standards)<\/b>:(.*?)(<br|$)/
const match = regex.exec(pageSource)
if (match) {
// Directly fail with the reason, the keyword found and report the PHP problem message, e.g.
// Error: Unwanted PHP Warning: "Attempt to read property \"id\" on null in <b>/joomla-cms/components/com_newsfeeds/src/View/Category/HtmlView.php</b> on line <b>92</b>"
throw new Error(`Unwanted PHP ${match?.[1]}: ${JSON.stringify(match?.[2])}`)
}
})
cy.log('--Check for PHP notices and warnings--')
})
Run the test specifications:
npx cypress run --spec tests/System/integration/site/components/com_newsfeed/NewsFeed.cy.js
Fails with:
Running: NewsFeed.cy.js (1 of 1)
Test in frontend that the newsfeeds details view
✓ can display a feed in a menu item from joomla.org (530ms)
1) "after each" hook for "can display a feed without a menu item from joomla.org"
1 passing (1s)
1 failing
1) Test in frontend that the newsfeeds details view
"after each" hook for "can display a feed without a menu item from joomla.org":
Error: Unwanted PHP Warning: " Attempt to read property \"id\" on null in <b>/Users/hlu/Desktop/no_backup/joomla-cms/components/com_newsfeeds/src/View/Newsfeed/HtmlView.php</b> on line <b>264</b>"
? With overwritten speaking checkForPhpNoticesOrWarnings
, if you run the entire system tests, there are four failures before this PR and only three after. The remaining three errors are fixed by #43879 and #43881.
No warnings in A) frontend view or B) System Test.
Please select:
Documentation link for docs.joomla.org:
No documentation changes for docs.joomla.org needed
Pull Request link for manual.joomla.org:
No documentation changes for manual.joomla.org needed
@LadySolveig @bembelimen there is no up-merge required as it is only a down-merge from 5.1-dev
Status | New | ⇒ | Pending |
Category | ⇒ | Front End com_newsfeeds |
I have tested this item ✅ successfully on 68097e9
Manual Test (A) only.
Status | Pending | ⇒ | Ready to Commit |
RTC
Status | Ready to Commit | ⇒ | Fixed in Code Base |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2024-08-06 08:54:40 |
Closed_By | ⇒ | laoneo | |
Labels |
Added:
RTC
|
Thanks!
I have tested this item ✅ successfully on 68097e9
This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43880.