Codeception / module-symfony

Codeception module for testing apps using Symfony framework
MIT License
88 stars 24 forks source link

Symfony 7 support #176

Closed dmamchyts closed 8 months ago

dmamchyts commented 8 months ago
/var/www/html $ composer req symfony/dom-crawler:^7.0.0

./composer.json has been updated
Running composer update symfony/dom-crawler
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires symfony/dom-crawler ^7.0.0, found symfony/dom-crawler[v7.0.0] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - codeception/lib-innerbrowser 3.1.3 requires symfony/dom-crawler ^4.4.30 || ^5.4 || ^6.0 -> found symfony/dom-crawler[v4.4.30, ..., v4.4.45, v5.4.0, ..., v5.4.32, v6.0.0, ..., v6.4.0] but it conflicts with your root composer.json require (^7.0.0).
    - codeception/module-symfony 3.2.0 requires codeception/lib-innerbrowser ^3.1.1 | ^4.0 -> satisfiable by codeception/lib-innerbrowser[3.1.3].
    - codeception/module-symfony is locked to version 3.2.0 and an update of this package was not requested.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Any plans to support Symfony 7? PS. Thanks for your work.

TavoNiievez commented 8 months ago

Hi @dmamchyts ,

Actually, there is a plan 😅. At the moment I'm working on updating dependencies and tests. Then I must support Symfony 6.4 (there is at least one open issue for this) before confirming that, without the deprecated code in 7.0, everything still works fine. First that, then this. I hope that by the end of the month this support will be ready unless something serious comes up that needs to be taken care of before.

dmamchyts commented 8 months ago

Windy Hugs

W0rma commented 8 months ago

@dmamchyts According to the output of composer req symfony/dom-crawler:^7.0.0 the installation is blocked by codeception/lib-innerbrowser.

Seems like you are still using version 3.1.3 of this package. Have you already considered updating to version 4.0.2? This version added support for symfony 7: https://github.com/Codeception/lib-innerbrowser/releases/tag/4.0.2

dmamchyts commented 8 months ago

@W0rma

/var/www/html $ composer req --dev codeception/lib-innerbrowser:4.0.2

./composer.json has been updated
Running composer update codeception/lib-innerbrowser
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires codeception/lib-innerbrowser 4.0.2 -> satisfiable by codeception/lib-innerbrowser[4.0.2].
    - codeception/lib-innerbrowser 4.0.2 requires phpunit/phpunit ^10.0 -> found phpunit/phpunit[10.0.0, ..., 10.5.5] but the package is fixed to 9.6.15 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
  Problem 2
    - codeception/lib-innerbrowser 4.0.2 requires phpunit/phpunit ^10.0 -> found phpunit/phpunit[10.0.0, ..., 10.5.5] but the package is fixed to 9.6.15 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
    - codeception/module-symfony 3.2.0 requires codeception/lib-innerbrowser ^3.1.1 | ^4.0 -> satisfiable by codeception/lib-innerbrowser[4.0.2].
    - codeception/module-symfony is locked to version 3.2.0 and an update of this package was not requested.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
/var/www/html $ composer req --dev phpunit/phpunit:^10.0
Xdebug: [Step Debug] Could not connect to debugging client. Tried: host.docker.internal:9003 (through xdebug.client_host/xdebug.client_port).
./composer.json has been updated
Running composer update phpunit/phpunit
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires phpunit/phpunit ^10.0, found phpunit/phpunit[10.0.0, ..., 10.5.5] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - codeception/assert-throws is locked to version 1.3.0 and an update of this package was not requested.
    - codeception/assert-throws 1.3.0 requires phpunit/phpunit ^8.0|^9.0|^10.0 -> found phpunit/phpunit[8.0.0, ..., 8.5.36, 9.0.0, ..., 9.6.15, 10.0.0, ..., 10.5.5] but these were not loaded, likely because it conflicts with another require.
  Problem 3
    - codeception/codeception is locked to version 5.0.13 and an update of this package was not requested.
    - codeception/codeception 5.0.13 requires phpunit/phpunit ^9.5.20 || ^10.0 -> found phpunit/phpunit[9.5.20, ..., 9.6.15, 10.0.0, ..., 10.5.5] but these were not loaded, likely because it conflicts with another require.
  Problem 4
    - codeception/codeception 5.0.13 requires phpunit/phpunit ^9.5.20 || ^10.0 -> found phpunit/phpunit[9.5.20, ..., 9.6.15, 10.0.0, ..., 10.5.5] but these were not loaded, likely because it conflicts with another require.
    - codeception/module-symfony 3.2.0 requires codeception/codeception ^5.0.8 -> satisfiable by codeception/codeception[5.0.13].
    - codeception/module-symfony is locked to version 3.2.0 and an update of this package was not requested.

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

General problem in https://github.com/Codeception/module-symfony/blob/main/composer.json (^7.0 missing in all symfony dependencies)

W0rma commented 8 months ago

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.

Have you already tried this hint provided in the output of composer?

General problem in https://github.com/Codeception/module-symfony/blob/main/composer.json (^7.0 missing in all symfony dependencies)

I don't think so because the symfony packages are only listed in the "require-dev" section of composer/module-symfony.

Feel free to share your composer.json if you still have problems.

dmamchyts commented 8 months ago

@W0rma

We have explicit package dependencies from symfony in require section:

{
    "name": "XXX",
    "description": "YYY",
    "license": "proprietary",
    "type": "project",
    "require": {
        "php": ">=8.2.8",
        "ext-ctype": "*",
        "ext-curl": "*",
        "ext-iconv": "*",
        "ext-intl": "*",
        "ext-mbstring": "*",
        "ext-pdo": "*",
        "ext-pdo_mysql": "*",
        "composer/semver": "^3.4.0",
        "doctrine/doctrine-bundle": "^2.11.1",
        "doctrine/doctrine-migrations-bundle": "^3.3.0",
        "doctrine/orm": "^2.17.2",
        "firebase/php-jwt": "^6.10.0",
        "jfcherng/php-diff": "^6.15.3",
        "moment/moment": "^2.30.1",
        "predis/predis": "^2.2.2",
        "symfony/asset": "^7.0.0",
        "symfony/cache": "^7.0.2",
        "symfony/console": "^7.0.2",
        "symfony/dotenv": "^7.0.2",
        "symfony/event-dispatcher": "^7.0.2",
        "symfony/expression-language": "^7.0.2",
        "symfony/flex": "^2.4.3",
        "symfony/http-client": "^7.0.2",
        "symfony/mime": "^7.0.0",
        "symfony/monolog-bundle": "^3.10",
        "symfony/process": "^7.0.2",
        "symfony/property-access": "^7.0.0",
        "symfony/runtime": "^7.0.0",
        "symfony/security-bundle": "^7.0.2",
        "symfony/serializer": "^7.0.2",
        "symfony/twig-bundle": "^7.0.0",
        "symfony/uid": "^7.0.0",
        "symfony/validator": "^7.0.2",
        "symfony/yaml": "^7.0.0",
        "twbs/bootstrap": "^5.3.2",
        "twbs/bootstrap-icons": "^1.11.3"
    },
    "require-dev": {
        "codeception/assert-throws": "^1.3.0",
        "codeception/codeception": "^5.0.13",
        "codeception/module-asserts": "^3.0",
        "codeception/module-rest": "^3.3.2",
        "codeception/module-symfony": "^3.2.0",
        "doctrine/doctrine-fixtures-bundle": "^3.5.1",
        "ergebnis/composer-normalize": "^2.41.1",
        "fakerphp/faker": "^1.23.1",
        "friendsofphp/php-cs-fixer": "^3.46.0",
        "nelmio/api-doc-bundle": "^4.16.2",
        "phpstan/phpstan": "^1.10.55",
        "phpstan/phpstan-doctrine": "^1.3.54",
        "phpstan/phpstan-strict-rules": "^1.5.2",
        "phpunit/php-code-coverage": "^9.2.30",
        "symfony/maker-bundle": "^1.52.0",
        "symfony/stopwatch": "^7.0.0",
        "symfony/web-profiler-bundle": "^7.0.2"
    },
    "replace": {
        "symfony/polyfill-ctype": "*",
        "symfony/polyfill-iconv": "*",
        "symfony/polyfill-intl-grapheme": "*",
        "symfony/polyfill-intl-idn": "*",
        "symfony/polyfill-intl-normalizer": "*",
        "symfony/polyfill-mbstring": "*",
        "symfony/polyfill-php72": "*",
        "symfony/polyfill-php73": "*",
        "symfony/polyfill-php80": "*",
        "symfony/polyfill-php81": "*",
        "symfony/polyfill-php82": "*",
        "symfony/polyfill-php83": "*"
    },
    "conflict": {
        "symfony/symfony": "*"
    },
    "minimum-stability": "stable",
    "prefer-stable": true,
    "autoload": {
        "psr-4": {
            "App\\": "src/"
        }
    },
    "autoload-dev": {
        "psr-4": {
            "App\\Tests\\": "tests/",
            "App\\Tests\\Functional\\": "tests/functional/",
            "App\\Tests\\Unit\\": "tests/unit/src/"
        }
    },
    "config": {
        "allow-plugins": {
            "composer/installers": false,
            "composer/package-versions-deprecated": true,
            "ergebnis/composer-normalize": true,
            "oomphinc/composer-installers-extender": false,
            "symfony/flex": true,
            "symfony/runtime": true
        },
        "preferred-install": {
            "*": "dist"
        },
        "sort-packages": true
    },
    "scripts": {
        "post-install-cmd": [
            "@auto-scripts"
        ],
        "post-update-cmd": [
            "@auto-scripts"
        ],
        "auto-scripts": {
            "cache:clear": "symfony-cmd",
            "assets:install %PUBLIC_DIR%/assets": "symfony-cmd",
            "app:assets %PUBLIC_DIR%/assets": "symfony-cmd"
        }
    }
}
/var/www/html $ composer req --with-all-dependencies --dev codeception/lib-innerbrowser:4.0.2

./composer.json has been updated
Running composer update codeception/lib-innerbrowser --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - phpunit/phpunit[10.0.0, ..., 10.0.19] require phpunit/php-code-coverage ^10.0 -> found phpunit/php-code-coverage[10.0.0, ..., 10.1.11] but it conflicts with your root composer.json require (^9.2.30).
    - phpunit/phpunit 10.1.0 requires phpunit/php-code-coverage ^10.1 -> found phpunit/php-code-coverage[10.1.0, ..., 10.1.11] but it conflicts with your root composer.json require (^9.2.30).
    - phpunit/phpunit[10.1.1, ..., 10.3.3] require phpunit/php-code-coverage ^10.1.1 -> found phpunit/php-code-coverage[10.1.1, ..., 10.1.11] but it conflicts with your root composer.json require (^9.2.30).
    - phpunit/phpunit[10.3.4, ..., 10.5.5] require phpunit/php-code-coverage ^10.1.5 -> found phpunit/php-code-coverage[10.1.5, ..., 10.1.11] but it conflicts with your root composer.json require (^9.2.30).
    - codeception/lib-innerbrowser 4.0.2 requires phpunit/phpunit ^10.0 -> satisfiable by phpunit/phpunit[10.0.0, ..., 10.5.5].
    - Root composer.json requires codeception/lib-innerbrowser 4.0.2 -> satisfiable by codeception/lib-innerbrowser[4.0.2].
W0rma commented 8 months ago

Problem 1

  • phpunit/phpunit[10.0.0, ..., 10.0.19] require phpunit/php-code-coverage ^10.0 -> found phpunit/php-code-coverage[10.0.0, ..., 10.1.11] but it conflicts with your root composer.json require (^9.2.30).
  • phpunit/phpunit 10.1.0 requires phpunit/php-code-coverage ^10.1 -> found phpunit/php-code-coverage[10.1.0, ..., 10.1.11] but it conflicts with your root composer.json require (^9.2.30).
    • phpunit/phpunit[10.1.1, ..., 10.3.3] require phpunit/php-code-coverage ^10.1.1 -> found phpunit/php-code-coverage[10.1.1, ..., 10.1.11] but it conflicts with your root composer.json require (^9.2.30).
    • phpunit/phpunit[10.3.4, ..., 10.5.5] require phpunit/php-code-coverage ^10.1.5 -> found phpunit/php-code-coverage[10.1.5, ..., 10.1.11] but it conflicts with your root composer.json require (^9.2.30).
  • codeception/lib-innerbrowser 4.0.2 requires phpunit/phpunit ^10.0 -> satisfiable by phpunit/phpunit[10.0.0, ..., 10.5.5].
    • Root composer.json requires codeception/lib-innerbrowser 4.0.2 -> satisfiable by codeception/lib-innerbrowser[4.0.2].

The output of composer already points to the root cause of the error: In your composer.json you require "phpunit/php-code-coverage": "^9.2.30", but codeception/lib-innerbrowser:4.0.2 requires at least phpunit/phpunit:^10.0 which itself requires at least phpunit/php-code-coverage ^10.1.

You should first update phpunit/php-code-coverage (don't forget --with-all-dependencies if you use composer req). I'm pretty sure that with this update codeception/lib-innerbrowser will be upgraded automatically.

dmamchyts commented 8 months ago
/var/www/html $ composer req --with-all-dependencies --dev phpunit/php-code-coverage ^10.1

./composer.json has been updated
Running composer update phpunit/php-code-coverage --with-all-dependencies
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Root composer.json requires phpunit/php-code-coverage ^10.1, found phpunit/php-code-coverage[10.1.0, ..., 10.1.11] but these were not loaded, likely because it conflicts with another require.
  Problem 2
    - codeception/codeception is locked to version 5.0.13 and an update of this package was not requested.
    - codeception/codeception 5.0.13 requires phpunit/php-code-coverage ^9.2 || ^10.0 -> found phpunit/php-code-coverage[9.2.0, ..., 9.2.30, 10.0.0, ..., 10.1.11] but these were not loaded, likely because it conflicts with another require.
  Problem 3
    - phpunit/phpunit 9.6.15 requires phpunit/php-code-coverage ^9.2.28 -> found phpunit/php-code-coverage[9.2.28, 9.2.29, 9.2.30] but it conflicts with your root composer.json require (^10.1).
    - codeception/assert-throws 1.3.0 requires phpunit/phpunit ^8.0|^9.0|^10.0 -> satisfiable by phpunit/phpunit[9.6.15].
    - codeception/assert-throws is locked to version 1.3.0 and an update of this package was not requested.
dmamchyts commented 8 months ago

Hm... Very strange.

1) remove "phpunit/php-code-coverage": "^9.2.30", line from composer.json 2) composer update (Upgrading phpunit/php-code-coverage (9.2.30 => 10.1.11): Extracting archive and some other libs) 3) composer req --dev phpunit/php-code-coverage ^10.1

profit