Codeception icon indicating copy to clipboard operation
Codeception copied to clipboard

Trying to fix `vendor/bin/codecept bootstrap` command for Codeception 5

Open ThomasLandauer opened this issue 3 years ago • 2 comments

I don't really know what I'm doing here, so this is probably not the right way to fix it!

Anyway - when following https://codeception.com/quickstart, I'm getting v1.0.0 of module-phpbrowser and module-asserts added to composer.json, which aren't compatible with Codeception 5.

Output:

$ php vendor/bin/codecept bootstrap
 Bootstrapping Codeception 

File codeception.yml created       <- global configuration
 Adding codeception/module-phpbrowser for PhpBrowser to composer.json
 Adding codeception/module-asserts for Asserts to composer.json
2 new packages added to require-dev
? composer.json updated. Do you want to run "composer update"? (y/n) y
 Running composer update
Loading composer repositories with package information
Updating dependencies
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - codeception/module-phpbrowser[1.0.0, ..., 1.0.1] require php >=5.6.0 <8.0 -> your php version (8.1.8) does not satisfy that requirement.
    - codeception/module-phpbrowser 1.0.2 requires codeception/codeception ^4.0 -> found codeception/codeception[4.0.0, ..., 4.2.1] but it conflicts with your root composer.json require (^5.0).
    - codeception/module-phpbrowser 1.0.3 requires codeception/codeception ^4.1 -> found codeception/codeception[4.1.0, ..., 4.2.1] but it conflicts with your root composer.json require (^5.0).
    - Root composer.json requires codeception/module-phpbrowser ^1.0.0 -> satisfiable by codeception/module-phpbrowser[1.0.0, 1.0.1, 1.0.2, 1.0.3].

Use the option --with-all-dependencies (-W) to allow upgrades, downgrades and removals for packages currently locked to specific versions.
 Composer installation failed. Please check composer.json and try to run "composer update" manually

In ModuleContainer.php line 100:
                                                     
  Module Asserts is not installed.                   
  Use Composer to install corresponding package:     
                                                     
  composer require codeception/module-asserts --dev  
                                                     

bootstrap [-s|--namespace [NAMESPACE]] [-a|--actor [ACTOR]] [-e|--empty] [--] [<path>]

ThomasLandauer avatar Aug 08 '22 16:08 ThomasLandauer

I noticed this issue too and raised #6542

^3.0 is a better constraint for Codeception 5, but not all modules have versions 3 yet, for example module-cli is at 2.0.0 still, because no changes were required to support Codeception 5, and module-yii2 is 1.1.4.

It is possible that none of these modules are used in templates, but we will certainly have to release module-webdriver 4.0.0 to support PHPUnit 10.

The simplest and most flexible solution would be to use * in constrait, alternatively we could specify version constraint of each module in template:

    $this->addModulesToComposer(['WebDriver' => '^3.0 | ^4.0']);

Naktibalda avatar Aug 09 '22 06:08 Naktibalda

What's the purpose of having this code at all? Is this just used in bootstrap or somewhere else too?

Cause it looks like a nightmare to maintain - so maybe the best solution is getting rid of it...?

ThomasLandauer avatar Aug 09 '22 09:08 ThomasLandauer

See https://codeception.com/docs/Customization#Installation-Templates

Naktibalda avatar Aug 11 '22 10:08 Naktibalda

I fixed this and other template issues in https://github.com/Codeception/Codeception/pull/6552 please review it.

Naktibalda avatar Aug 12 '22 13:08 Naktibalda

Great! :-)

ThomasLandauer avatar Aug 12 '22 13:08 ThomasLandauer