尝试运行 Composer install 时出错 - "requirements could not be resolved"



几天前我开始使用PHPUnit,遇到了这个问题。我想在一个项目中测试一些类,我从github克隆。在项目中有两个文件夹:"tests"one_answers"src",每个文件夹中都有composer.json文件。在SRC文件夹中,文件看起来像这样:

{
    "require": {
      "php": ">=5.3.0",
      "monolog/monolog": "1.*",
      "slim/slim": "2.*"
    },
    "autoload": {
    "classmap": ["classes/"]
    }
}

,在tests文件夹中,文件看起来像这样:

{
    "require-dev": {
        "phpunit/phpunit": "dev-master"
    },
    "autoload": {
        "psr-0": {
            "adServerTesting": ""
        }
    }
}

所以我创建了这个统一的composer.json:

{
    "require": {
      "php": ">=5.3.0",
      "monolog/monolog": "1.*",
      "slim/slim": "2.*"
    },
    "require-dev": {
        "phpunit/phpunit": "dev-master"
    },
    "autoload": {
    "classmap": ["classes/"],
        "psr-0": {
            "adServerTesting": ""
        }
    }
}

但是当我运行composer install时,我得到以下错误:

Your requirements could not be resolved to an installable set of packages.
  Problem 1
    - Installation request for phpunit/phpunit dev-master -> satisfiable by phpunit/phpunit[dev-master].
    - phpunit/phpunit dev-master requires php >=5.6 -> your PHP version (5.5.9-1ubuntu4.11) does not satisfy that requirement.

因为我在我的机器上安装了phpunit,我试图从src文件夹路径内运行composer install,并且很好,命令和测试正确执行,但现在统一文件后,我得到了这个错误。我看到它说我有php 5.5.9,我需要升级,但为什么它的工作,当我从src文件夹运行composer install ??thx . .

phpunit/phpunit:@dev需要PHP 5.6,而你的PHP版本是5.5。

使用较低版本的PHPUnit,或者让编者决定。你可以通过调用:

composer require phpunit/phpunit --dev

--dev选项添加到require-dev

相关内容

  • 没有找到相关文章

最新更新