SwarrotBundle
SwarrotBundle copied to clipboard
Allow using the latest version of PHPUnit
While it does not mean that we can use the latest features, it means we can spot and address deprecations earlier. It also means the output of composer outdated is smaller, which in turns allows us to spot where work is needed more easily. Note that it also means running phpunit now also produces a warning about validating against a deprecated schema, and I do not think we can address it until we drop support for PHP <= 8.1, since PHPUnit 10 requires PHP 8.1+
Output of composer outdated
:
@@ -6,7 +6,6 @@
Direct dependencies required in composer.json:
php-amqplib/php-amqplib v3.6.0 v2.0.2 Formerly videlalvaro/php-amqplib. This library is a pure PHP implementation of the AMQP protocol. It's been tested against RabbitMQ.
-phpunit/phpunit 9.6.15 10.5.2 The PHP Unit Testing framework.
symfony/config v6.4.0 v7.0.0 Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console v6.4.1 v7.0.1 Eases the creation of beautiful and testable command line interfaces
symfony/dependency-injection v6.4.1 v7.0.1 Allows you to standardize and centralize the way objects are constructed in your application
@@ -16,24 +15,4 @@
symfony/yaml v6.4.0 v7.0.0 Loads and dumps YAML files
Transitive dependencies not required in composer.json:
-phpunit/php-code-coverage 9.2.29 10.1.10 Library that provides collection, processing, and rendering functionality for PHP code coverage information.
-phpunit/php-file-iterator 3.0.6 4.1.0 FilterIterator implementation that filters files based on a list of suffixes.
-phpunit/php-invoker 3.1.1 4.0.0 Invoke callables with a timeout
-phpunit/php-text-template 2.0.4 3.0.1 Simple template engine.
-phpunit/php-timer 5.0.3 6.0.0 Utility class for timing
-sebastian/cli-parser 1.0.1 2.0.0 Library for parsing CLI options
-sebastian/code-unit 1.0.8 2.0.0 Collection of value objects that represent the PHP code units
-sebastian/code-unit-reverse-lookup 2.0.3 3.0.0 Looks up which function or method a line of code belongs to
-sebastian/comparator 4.0.8 5.0.1 Provides the functionality to compare PHP values for equality
-sebastian/complexity 2.0.2 3.1.0 Library for calculating the complexity of PHP code units
-sebastian/diff 4.0.5 5.0.3 Diff implementation
-sebastian/environment 5.1.5 6.0.1 Provides functionality to handle HHVM/PHP environments
-sebastian/exporter 4.0.5 5.1.1 Provides the functionality to export PHP variables for visualization
-sebastian/global-state 5.0.6 6.0.1 Snapshotting of global state
-sebastian/lines-of-code 1.0.3 2.0.1 Library for counting the lines of code in PHP source code
-sebastian/object-enumerator 4.0.4 5.0.0 Traverses array structures and object graphs to enumerate all referenced objects
-sebastian/object-reflector 2.0.4 3.0.0 Allows reflection of object attributes, including inherited and non-public ones
-sebastian/recursion-context 4.0.5 5.0.0 Provides functionality to recursively process PHP variables
-sebastian/type 3.2.1 4.0.0 Collection of value objects that represent the types of the PHP type system
-sebastian/version 3.0.2 4.0.1 Library that helps with managing the version number of Git-hosted PHP projects
symfony/options-resolver v6.4.0 v7.0.0 Provides an improved replacement for the array_replace PHP function
Would this properly report deprecations or is this broken due to symfony/phpunit-bridge being incompatible with PHPUnit 10 ?
It seems to be working:
$ git diff
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
modified: Broker/Publisher.php
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
@ Broker/Publisher.php:33 @ public function __construct(FactoryInterface $factory, EventDispatcherInterface
public function publish(string $messageType, Message $message, array $overridenConfig = []): void
{
@trigger_error('this is a test', E_USER_DEPRECATED);
if (!$this->isKnownMessageType($messageType)) {
throw new \InvalidArgumentException(sprintf('Unknown message type "%s". Available are [%s].', $messageType, implode(',', array_keys($this->messageTypes))));
}
╭─~/dev/SwarrotBundle on maintenance ✘ (fork/maintenance)
╰$ vendor/bin/phpunit
PHPUnit 10.5.2 by Sebastian Bergmann and contributors.
Runtime: PHP 8.2.13
Configuration: /home/gregoire/dev/SwarrotBundle/phpunit.xml.dist
....SSSSS..S..................................................... 65 / 81 ( 80%)
.........SSSS... 81 / 81 (100%)
Time: 00:00.085, Memory: 16.00 MB
There was 1 PHPUnit test runner deprecation:
1) Your XML configuration validates against a deprecated schema. Migrate your XML configuration using "--migrate-configuration"!
OK, but there were issues!
Tests: 81, Assertions: 139, Deprecations: 1, Skipped: 10.
Remaining self deprecation notices (1)
1x: this is a test
1x in PublisherTest::testPublishWithUnknownMessageType from Swarrot\SwarrotBundle\Tests\Broker
Is that what you would test, or were you thinking of a more complex scenario?