wp-cli / doctor-command

Diagnose problems within WordPress by running a series of checks for symptoms
MIT License
146 stars 22 forks source link

Add list of files to report of 'wp doctor check cache-flush' command #191

Closed kiranpotphode closed 4 months ago

kiranpotphode commented 5 months ago

Fixes #184

This PR adds enhancement for the wp doctor check cache-flush command as mentioned in issue #184

The output will show the list of files where wp_cache_flush() is used.

wojtekn commented 4 months ago

@kiranpotphode, thanks for adjusting the output format, it's now more readable.

I've just checked tests and found out we will need to update those as they rely on the old message format:

composer behat -- features/check-cache-flush.feature
kiranpotphode commented 4 months ago

@kiranpotphode , thanks for adjusting the output format, it's now more readable.

I've just checked tests and found out we will need to update those as they rely on the old message format:

composer behat -- features/check-cache-flush.feature

@wojtekn Thanks for pointing that out. I have updated the test now. I also updated the doc block comment for the class.

ernilambar commented 4 months ago

@kiranpotphode Can you please rebase the PR with main branch? Now behat.yml file has been added. So GitHub actions will run with all functional tests.

kiranpotphode commented 4 months ago

@kiranpotphode (https://profiles.wordpress.org/kiranpotphode) Can you please rebase the PR with main branch? Now behat.yml file has been added. So GitHub actions will run with all functional tests.

@ernilambar I have updated my branch with the latest code from the main branch. However, I noticed that some tests are failing on GitHub actions.

But my tests on local are passing for the following command. composer behat -- features/check-cache-flush.feature

Can you guide what might the problem?

ernilambar commented 4 months ago

@kiranpotphode Yah, I noticed. wp_cache_flush() is there in sqlite-database-integration which is used for Sqlite implementation. Probably you have tested with mysql in your setup. That is why you are not seeing error in local.

Instead of STDOUT should be a table containing rows:, we could use STDOUT should contain:

When I run `wp doctor check cache-flush`
Then STDOUT should contain:
  """
  cache-flush
  """
And STDOUT should contain:
  """
  warning
  """
And STDOUT should contain:
  """
  Use of wp_cache_flush() detected
  """
And STDOUT should contain:
  """
  mu-plugins/plugin.php
  """
kiranpotphode commented 4 months ago

I have updated the tests. Now wp_cache_flush() related issues are fixed.

Still noticing some other failed tests for WP trunk on PHP 8.4 Scenario though.

ernilambar commented 4 months ago

@kiranpotphode WP is still not compatible to PHP 8.4. So we can ignore that now.