Unit/System Tests PR-5.4-dev Pending

User tests: Successful: Unsuccessful:

avatar alikon
alikon
7 Apr 2026

Summary of Changes

add system test for cli/joomla.php cache:clean command

Testing Instructions

run npx cypress run --spec tests/System/integration/cli/Cache.cy.js

Actual result BEFORE applying this Pull Request

N/A

Expected result AFTER applying this Pull Request

test

Link to documentations

Please select:

  • Documentation link for guide.joomla.org:

  • No documentation changes for guide.joomla.org needed

  • Pull Request link for manual.joomla.org:

  • No documentation changes for manual.joomla.org needed

  • I read the Generative AI policy and my contribution is either not created with the help of AI or is compatible with the policy and GNU/GPL 2 or later.

avatar alikon alikon - open - 7 Apr 2026
avatar alikon alikon - change - 7 Apr 2026
Status New Pending
avatar joomla-cms-bot joomla-cms-bot - change - 7 Apr 2026
Category JavaScript Unit Tests
avatar laoneo
laoneo - comment - 7 Apr 2026

Nice, would be good if you can create a file in the test and check afterwards if it gets deleted. Like that we know that the command actually works.

avatar alikon alikon - change - 8 Apr 2026
Labels Added: Unit/System Tests PR-5.4-dev
5ed5ab5 8 Apr 2026 avatar alikon cs
avatar laoneo
laoneo - comment - 8 Apr 2026

Now you are testing two things in one test, if module caching is working and the command. Also if else blocks should whenever possible be avoided in tests. Creating a file manually in the cache folder, running the command and testing if the file got deleted should be enough.

avatar alikon
alikon - comment - 8 Apr 2026

did you think something like this ?

describe('Test that console command cache', () => {
  it('can clean cache', () => {
    const cachedFile = Cypress.env('cmsPath') + 'administrator/cache/test.txt';
    cy.task('writeRelativeFile', { path: 'administrator/cache/test.txt', content: 'test delete file from cache', mode: 0o666 });
    cy.exec(`php ${Cypress.env('cmsPath')}/cli/joomla.php cache:clean`)
      .its('stdout')
      .should('contain', 'Cache cleaned');
    cy.readFile(cachedFile).should('not.exist');
  });
});
avatar laoneo
laoneo - comment - 8 Apr 2026

Yes exactly

28e6606 8 Apr 2026 avatar alikon cs

Add a Comment

Login with GitHub to post a comment