pestphp / pest

Pest is an elegant PHP testing Framework with a focus on simplicity, meticulously designed to bring back the joy of testing in PHP.
https://pestphp.com
MIT License
9.62k stars 358 forks source link

Installation Issues #75

Closed Wulfheart closed 4 years ago

Wulfheart commented 4 years ago

I'm getting the following error when following the installation instructions:

PS> composer require pestphp/pest --dev
Using version ^0.1.5 for pestphp/pest
./composer.json has been updated
Loading composer repositories with package information
Updating dependencies (including require-dev)
Your requirements could not be resolved to an installable set of packages.

  Problem 1
    - Installation request for pestphp/pest ^0.1.5 -> satisfiable by pestphp/pest[v0.1.5].
    - Conclusion: remove phpunit/phpunit 9.0.0
    - Conclusion: don't install phpunit/phpunit 9.0.0
    - pestphp/pest v0.1.5 requires phpunit/phpunit ^9.1.4 -> satisfiable by phpunit/phpunit[9.1.x-dev, 9.2.x-dev, 9.3.x-dev].
    - Can only install one of: phpunit/phpunit[9.1.x-dev, 9.0.0].
    - Can only install one of: phpunit/phpunit[9.2.x-dev, 9.0.0].
    - Can only install one of: phpunit/phpunit[9.3.x-dev, 9.0.0].
    - Installation request for phpunit/phpunit 9.0 -> satisfiable by phpunit/phpunit[9.0.0].

Installation failed, reverting ./composer.json to its original content.

Furthermore I'm quite nervous that composer require nunomaduro/collision:"^5.0" --dev --update-with-dependencies isn't available neither.

{
    "name": "laravel/laravel",
    "type": "project",
    "description": "The Laravel Framework.",
    "keywords": [
        "framework",
        "laravel"
    ],
    "license": "MIT",
    "require": {
        "php": "^7.2.5",
        "fideloper/proxy": "^4.2",
        "fruitcake/laravel-cors": "^1.0",
        "guzzlehttp/guzzle": "^6.3",
        "laravel-frontend-presets/tall": "^1.7",
        "laravel/framework": "^7.0",
        "laravel/tinker": "^2.0",
        "livewire/livewire": "^1.1",
        "raggitech/laravel-readable": "^1.0"
    },
    "require-dev": {
        "barryvdh/laravel-debugbar": "^3.3",
        "facade/ignition": "^2.0",
        "fzaninotto/faker": "^1.9.1",
        "laravel-shift/blueprint": "^1.13",
        "mockery/mockery": "^1.3.1",
        "nunomaduro/collision": "v5.0.0-BETA2",
        "phpunit/phpunit": "9.0"
    },
    "config": {
        "optimize-autoloader": true,
        "preferred-install": "dist",
        "sort-packages": true
    },
    "extra": {
        "laravel": {
            "dont-discover": []
        }
    },
    "autoload": {
        "psr-4": {
            "App\\": "app/"
        },
        "classmap": [
            "database/seeds",
            "database/factories"
        ]
    },
    "autoload-dev": {
        "psr-4": {
            "Tests\\": "tests/"
        }
    },
    "minimum-stability": "dev",
    "prefer-stable": true,
    "scripts": {
        "post-autoload-dump": [
            "Illuminate\\Foundation\\ComposerScripts::postAutoloadDump",
            "@php artisan package:discover --ansi"
        ],
        "post-root-package-install": [
            "@php -r \"file_exists('.env') || copy('.env.example', '.env');\""
        ],
        "post-create-project-cmd": [
            "@php artisan key:generate --ansi"
        ]
    }
}
nunomaduro commented 4 years ago

Did you follow the installation guide? Line by line?

Wulfheart commented 4 years ago

Yes. But I had to edit the version of the collision package.

canvural commented 4 years ago

You have "phpunit/phpunit": "9.0" in your composer json. It means you only allow 9.0 but pest requires 9.1. So I believe if you change it to "phpunit/phpunit": "^9.0" it should work correctly. Unless there is a reason why you are exactly on 9.0

Wulfheart commented 4 years ago

No. I just followed the instructions 🤷🏼‍♂️

nunomaduro commented 4 years ago
Screenshot 2020-06-09 at 00 30 55

Yeah - instructions tell you to change it to "phpunit/phpunit": "^9.0" and not "phpunit/phpunit": "9.0". 👍

Wulfheart commented 4 years ago

Thanks. Now it is working.

However the version of the collision package is unable to get with copy and paste via composer.

underdpt commented 4 years ago

Just a notice here, I also followed the instructions (copy & paste) and ended with composer.json line:

"phpunit/phpunit": "9.0"

Maybe it's a composer issue? (tried with composer 1.10.1 and 1.10.7)

Also failed to install nunomaduro/collision ^5.0, i had to issue:

composer require nunomaduro/collision:"^5.0.0-BETA2" --dev --update-with-dependencies
owenvoke commented 4 years ago

@underdpt, do you happen to be on Windows?

underdpt commented 4 years ago

Yes

owenvoke commented 4 years ago

Yeah, I've had that issue before. ^ is the escape character on Windows command line (at least in Command Prompt), so it ends up just being "9.0" as it escapes the 9.

I'm not really sure what the best way of solving this is. On Windows, it has to be "^^9.0" to escape the escape character.

alexmartinfr commented 4 years ago

Since the caret is a shorthand in composer, maybe we should provide the full syntax it refers to?

composer require phpunit/phpunit:">=9.0.0 <10.0.0" --dev --update-with-dependencies

See composer documentation for "Caret Version Range"