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鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set PHP 7.2 as minimum version, upgrade to PHPUnit 8.5 and GuzzleHttp 7.7 #1903

Merged
merged 21 commits into from Aug 18, 2023

Conversation

dregad
Copy link
Member

@dregad dregad commented Aug 8, 2023

The PR is created in draft mode, because at this stage it is still a work-in-progress. There are remaining issues when running PHPUnit tests locally with PHP 8.1 and above that need to be resolved, but 7.4 and 8.0 seem to be fine.

The early submission allows the code changes to go through our standard TravisCI build process, and gives everyone an opportunity to preview and test. Feedback would be appreciated 馃檹

This fixes:

@dregad dregad self-assigned this Aug 8, 2023
@dregad dregad force-pushed the php72 branch 2 times, most recently from 34207fa to 1347713 Compare August 14, 2023 15:00
dregad and others added 18 commits August 14, 2023 17:27
With PHPUnit 8.5, which supports PHP >= 7.2, we no longer need the
temporary changes from issue #29882 to provide PHP 8.1 compatibility.

This reverts commit f82c03b by removing
the dependencies on custom forks of PHPUnit and required libraries.

Fixes #32810
  - Removing phpdocumentor/reflection-common (1.0.1)
  - Removing phpdocumentor/reflection-docblock (4.3.4)
  - Removing phpdocumentor/type-resolver (0.5.1)
  - Removing phpspec/prophecy (v1.10.3)
  - Removing phpunit/phpunit-mock-objects (5.0.10)
  - Removing symfony/polyfill-ctype (v1.19.0)
  - Removing webmozart/assert (1.9.1)
  - Upgrading doctrine/instantiator (1.0.5 => 1.5.0)
  - Upgrading myclabs/deep-copy (1.7.0 => 1.11.1)
  - Upgrading phar-io/manifest (1.0.1 => 2.0.3)
  - Upgrading phar-io/version (1.0.1 => 3.2.1)
  - Upgrading phpunit/php-code-coverage (dev-mantis-5.3 7642884 => 7.0.15)
  - Upgrading phpunit/php-file-iterator (dev-mantis-1.4 89be108 => 2.0.5)
  - Upgrading phpunit/php-timer (1.0.9 => 2.1.3)
  - Upgrading phpunit/php-token-stream (2.0.2 => 3.1.3)
  - Upgrading phpunit/phpunit (dev-mantis-6.5 215feef => 8.5.33)
  - Upgrading sebastian/comparator (2.1.3 => 3.0.5)
  - Upgrading sebastian/diff (2.0.1 => 3.0.4)
  - Upgrading sebastian/environment (3.1.0 => 4.2.4)
  - Upgrading sebastian/exporter (3.1.4 => 3.1.5)
  - Upgrading sebastian/global-state (2.0.0 => 3.0.3)
  - Upgrading sebastian/resource-operations (1.0.0 => 2.0.2)
  - Locking sebastian/type (1.1.4)
  - Upgrading theseer/tokenizer (1.1.3 => 1.2.1)
Replace with assertThat() and isType() constraint.
Replace with $this->expectException()
Replace with assertStringContainsString()
Replace with expectExceptionMessageMatches()
Prevents PHPUnit from throwing a warning:
No tests found in class "RestBase".
  - Removing symfony/polyfill-php72 (v1.19.0)
  - Removing symfony/polyfill-php70 (v1.19.0)
  - Removing symfony/polyfill-intl-normalizer (v1.19.0)
  - Removing symfony/polyfill-intl-idn (v1.19.0)
  - Removing paragonie/random_compat (v9.99.100)
  - Installing symfony/deprecation-contracts (v2.5.2)
  - Installing psr/http-client (1.0.2)
  - Upgrading guzzlehttp/guzzle (6.5.8 => 7.6.1)

Fixes #32807
Initialize defaultSoapClientOptions property in setUp(), to avoid a
syntax error due to undefined constant WSDL_CACHE_NONE.

Remove useless SoapAllTests::setUp() method. TestSuite class does not
have this method so it is never actually called. Extension availability
check is performed by `@requires extension` hints in the test cases'
PHPDoc blocks.

Fixes #32814
Argument #1 of PHPUnit\Framework\TestSuite::addTestSuite() must be a
class name or object

AllTests::suite() method called addTest() instead of addTestSuite()
to include the 3 tests suites.

Fixes #32815
Until today, the test suites were defined in "AllTests.php" files using
the PHPUnit\Framework\TestSuite class, which is meant for internal use.

The official, documented method to compose a test suite is to use XML
configuration.

This commit introduces the phpunit.xml, which replaces the AllTests.php
scripts, and updates documentation and TravisCI script.

Fixes #32816
When building test email addresses, use the user and domain from the
TEST_EMAIL constant, to ensure the test cases in providerEmailUnique
remain relevant in case the reference email is modified.
This avoids 'sh: 1: /usr/sbin/sendmail: not found' error message
displayed after PHPUnit suite execution, as sendmail is not installed on
Travis.

Note: This is not a "real" error and does not actually cause the build
to fail, but it could lead someone reviewing the build's log to think
that something went wrong, so it should be fixed to avoid confusion.

The fakesendmail.sh script was copied from PHPMailer's test suite [1].
It will generate a .eml file in /tmp/fakemail directory, each time
the test suite sends an email.

Fixes #32828

[1]: https://github.com/PHPMailer/PHPMailer/blob/v6.8.0/test/fakesendmail.sh
@dregad dregad marked this pull request as ready for review August 15, 2023 08:20
@dregad
Copy link
Member Author

dregad commented Aug 15, 2023

I believe I've now identified and fixed all issues related to upgrading the test suite to PHPUnit 8.5.

So this PR is now ready for review. I'm planning to merge it by the end of the week, please test provide your feedback by then.

dregad added a commit that referenced this pull request Aug 18, 2023
@dregad dregad merged commit 0e1fce2 into mantisbt:master Aug 18, 2023
1 check passed
@dregad dregad deleted the php72 branch August 18, 2023 22:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants