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

Unify cache configuration #4599

Closed
sebastianbergmann opened this issue Feb 8, 2021 · 1 comment
Closed

Unify cache configuration #4599

sebastianbergmann opened this issue Feb 8, 2021 · 1 comment
Assignees
Labels
feature/test-runner CLI test runner type/backward-compatibility Something will be/is intentionally broken
Milestone

Comments

@sebastianbergmann
Copy link
Owner

sebastianbergmann commented Feb 8, 2021

A phpunit.xml configuration file that uses best practice defaults (as generated using --generate-configuration) for PHPUnit 9.5 looks like this:

<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.5/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         cacheResultFile=".phpunit.cache/test-results"
         executionOrder="depends,defects"
         forceCoversAnnotation="true"
         beStrictAboutCoversAnnotation="true"
         beStrictAboutOutputDuringTests="true"
         beStrictAboutTodoAnnotatedTests="true"
         failOnRisky="true"
         failOnWarning="true"
         verbose="true">
    <testsuites>
        <testsuite name="default">
            <directory suffix="Test.php">tests</directory>
        </testsuite>
    </testsuites>

    <coverage cacheDirectory=".phpunit.cache/code-coverage"
              processUncoveredFiles="true">
        <include>
            <directory suffix=".php">src</directory>
        </include>
    </coverage>
</phpunit>

The cacheResultFile attribute of the <phpunit> root element (as well as the --cache-result-file <file> CLI option) is used to configure the file where the PHPUnit test runner stores its test result cache.

The cacheDirectory attribute of the <coverage> element (as well as the --coverage-cache <dir> CLI option) is used to configure the directory where static analysis results for code coverage are cached.

In the future, there will be more "things" we would like to cache. I therefore propose the following:

  • Deprecate the cacheResultFile attribute of the <phpunit> root element (as well as the --cache-result-file <file> CLI option) in PHPUnit 10 (and remove support for it in PHPUnit 11)
  • Deprecate the cacheDirectory attribute of the <coverage> element (as well as the --coverage-cache <dir> CLI option) in PHPUnit 10 (and remove support for it in PHPUnit 11)
  • Introduce the cacheDirectory attribute on the <phpunit> root element (as well as the --cache-directory <dir> CLI option) for configuring a single root directory for cache directories and cache files used by the PHPUnit test runner in PHPUnit 10
  • Change --generate-configuration to generate the following
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.0/phpunit.xsd"
         bootstrap="vendor/autoload.php"
         cacheDirectory=".phpunit.cache"
         executionOrder="depends,defects"
         forceCoversAnnotation="true"
         beStrictAboutCoversAnnotation="true"
         beStrictAboutOutputDuringTests="true"
         beStrictAboutTodoAnnotatedTests="true"
         failOnRisky="true"
         failOnWarning="true"
         verbose="true">
    <testsuites>
        <testsuite name="default">
            <directory suffix="Test.php">tests</directory>
        </testsuite>
    </testsuites>

    <coverage processUncoveredFiles="true">
        <include>
            <directory suffix=".php">src</directory>
        </include>
    </coverage>
</phpunit>
@sebastianbergmann sebastianbergmann added type/backward-compatibility Something will be/is intentionally broken feature/test-runner CLI test runner labels Feb 8, 2021
@sebastianbergmann sebastianbergmann added this to the PHPUnit 10.0 milestone Feb 8, 2021
@sebastianbergmann sebastianbergmann self-assigned this Feb 8, 2021
sebastianbergmann added a commit to sebastianbergmann/phpunit-documentation-english that referenced this issue Nov 29, 2021
stronk7 added a commit to stronk7/moodle that referenced this issue Feb 15, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue May 3, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue May 10, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue May 17, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue May 25, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue May 31, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue Jun 8, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue Jun 14, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue Jun 24, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue Jun 27, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue Jul 5, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
stronk7 added a commit to stronk7/moodle that referenced this issue Jul 22, 2024
This comes with a good number of changes:

1. The convertXXXXToExceptions are gone, with notices,
   warnings and others not being shown by default. To
   mimic the previous behaviour we are enabling all these:
   - failOnNotice
   - failOnWarning
   - displayDetailsOnTestsThatTriggerDeprecations
   - displayDetailsOnTestsThatTriggerErrors
   - displayDetailsOnTestsThatTriggerNotices
   - displayDetailsOnTestsThatTriggerWarnings

   With them the behaviour is 99% the same than the previous one.
   Still there are some defaults that should be considered, like
   failing on Incomplete, Risky, Deprecation... but they were
   not enabled previously, so I've left them apart (not failing
   and not showing details). They can be enabled with a simple -v.

2. backupStaticAttributes renamed to backupStaticProperties.

3. stopOnXXX removed, because all them default to false, so no needed.

4. Added cacheDirectory (.phpunit.cache) for anybody wanting to use
   it via command line --cache-result option (also @ .gitignore).
   Also ensure that the distributed phpunit.xml files are generated
   pointing to it. We remove the previous .phpunit.result.cache file,
   because it's deprecated by sebastianbergmann/phpunit#4599

5. Enabled beStrictAboutChangesToGlobalState , not sure about it but can
   help to detect cases where something is changed without noticing.

6. The <coverage> section is now only to configure how coverage
   should be generated and evaluated. The lists of directories and files
   have been moved to the new <source> section.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature/test-runner CLI test runner type/backward-compatibility Something will be/is intentionally broken
Projects
None yet
Development

No branches or pull requests

2 participants
@sebastianbergmann and others