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

[4.4] Set publish_up in db_createArticle #43881

Merged
merged 10 commits into from
Aug 6, 2024

Conversation

muhme
Copy link
Contributor

@muhme muhme commented Aug 4, 2024

Summary of Changes

After #43879 and #43880 there are two System Tests are failing with Error: Unwanted PHP Deprecated. This PR fix them and is:

Testing Instructions

The errors are displayed in the System Test after you have upgraded checkForPhpNoticesOrWarnings to output. Verify the failed tests before patching. After patching, check if the test run was successful.

Actual result BEFORE applying this Pull Request

As preparation for the Cypress System Test install checkForPhpNoticesOrWarnings with output in overwriting lines 74 ... 89 in node_modules/joomla-cypress/src/support.jswith 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 two test specifications:

npx cypress run --spec tests/System/integration/site/components/com_content/Featured.cy.js,tests/System/integration/site/modules/mod_related_items/Default.cy.js

Fails with:

Running:  components/com_content/Featured.cy.js                                           (1 of 2)

  Test in frontend that the content featured view
    ✓ can display an article (382ms)
    ✓ can not display not featured articles (116ms)
    1) "after each" hook for "can navigate to the article"

  2 passing (1s)
  1 failing

  1) Test in frontend that the content featured view
       "after each" hook for "can navigate to the article":
     Error: Unwanted PHP Deprecated: "  DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in <b>/Users/hlu/Desktop/no_backup/joomla-cms/libraries/src/Date/Date.php</b> on line <b>126</b>"

...

Running:  modules/mod_related_items/Default.cy.js                                         (2 of 2)

  Test in frontend that the related items module
    1) "after each" hook for "can display a list of related articles based on the metakey field"

  0 passing (874ms)
  1 failing

  1) Test in frontend that the related items module
       "after each" hook for "can display a list of related articles based on the metakey field":
     Error: Unwanted PHP Deprecated: "  DateTime::__construct(): Passing null to parameter #1 ($datetime) of type string is deprecated in <b>/Users/hlu/Desktop/no_backup/joomla-cms/libraries/src/Date/Date.php</b> on line <b>126</b>"

💡 With overwritten speaking checkForPhpNoticesOrWarnings, if you run the entire system tests, there are four failures before this PR and only two after. #43879 and #43880 are fixing the other two.

💡 Do you running Cypress test in GUI mode and wonder where the deprecated errors are? They are hidden and you have to inspect the published date to see them in the HTML source code:
screenshot

Expected result AFTER applying this Pull Request

No deprecated errors in System Test with overwritten checkForPhpNoticesOrWarnings.

Link to documentations

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

Up-Merging

@LadySolveig @bembelimen there is no up-merge required as it is only a down-merge from 5.1-dev

muhme added 9 commits June 7, 2024 06:47
Consider file permissions when writing configuration in system tests …
merge joomla/joomla-cms branch 4.4-dev
merge head-repository joomla/joomla-cms
merge head repository joomla/joomla-cms
merge from head repository
as down-merge from 5.1-dev
@alikon
Copy link
Contributor

alikon commented Aug 5, 2024

I have tested this item ✅ successfully on 9224986


This comment was created with the J!Tracker Application at issues.joomla.org/tracker/joomla-cms/43881.

@laoneo laoneo merged commit fd67382 into joomla:4.4-dev Aug 6, 2024
2 of 3 checks passed
@laoneo
Copy link
Member

laoneo commented Aug 6, 2024

Thanks!

@laoneo laoneo added this to the Joomla! 4.4.7 milestone Aug 6, 2024
@muhme muhme deleted the db-create-article-publish-up branch August 6, 2024 09:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants