用composer来运行的测试命令(附实例)

193 阅读1分钟

如果你想用composer来运行你的测试命令,你可以按照下面的例子。

{
  ...
  "scripts": {
      ...
      "cache": [
          "rm -rf app/cache/*"
      ],
      "composer": [
          "composer self-update",
          "composer install --no-interaction"
      ],
      "doctrine": [
          "php app/doctrine:generate:entities AppBundle --no-backup --env=test",
          "php app/doctrine:schema:create --no-interaction --env=test",
          "php app/doctrine:schema:update --force --no-interaction --no-debug --env=test"
      ],
      "fixtures": [
          "php doctrine:fixtures:load --no-interaction --no-debug --env=test"
      ],
      "styling": [
          "php app/php-cs-fixer fix --dry-run --verbose -diff"
      ],
      "behat": [
          "php app/behat --suite=app --format=progress"
      ],
      "security": [
          "php app/console security:check"
      ],
      "tests": [
          "@security",
          "@styling",
          "@cache",
          "@composer",
          "@doctrine",
          "@styling",
          "@fixtures",
          "@behat"
      ]
      ...
  }
  ...
}

结果

$ composer security
$ composer styling
$ composer ...
$ composer tests