CircleCI不导入依赖项

时间:2019-06-14 18:26:41

标签: php composer-php circleci

我的CircleCI测试由于缺少依赖项而失败,即使我的本地测试通过得很好:

1) Tests\Feature\NetworkedObjectRegistrationTest::itRegistersNetworkedObjects
    Error: Class 'Ramsey\Uuid\UUID' not found

依赖性在测试类中导入:

use App\Models\User;
use App\Models\NetworkedObjectAbility;

use Ramsey\Uuid\UUID;

class NetworkedObjectRegistrationTest extends TestCase
{
    use RefreshDatabase;
    ...

并出现在composer.json中:

    "require": {
        ...
        "ramsey/uuid": "^3.8"
    },

CircleCI配置:

version: 2

jobs:
  build:
    docker:
      - image: circleci/php:7.1-node-browsers
    working_directory: ~/laravel
    steps:
      - checkout
      - run: sudo apt install -y libsqlite3-dev zlib1g-dev
      - run: sudo docker-php-ext-install zip
      - run: sudo composer self-update
      - restore_cache:
          keys:
            - composer-v1-{{ checksum "composer.lock" }}
            - composer-v1-
      - run: composer update
      - run: composer install
      - save_cache:
          key: composer-v1-{{ checksum "composer.lock" }}
          paths:
            - vendor
      - restore_cache:
          keys:
            - node-v1-{{ checksum "package.json" }}
            - node-v1-
      - run: yarn install
      - save_cache:
          key: node-v1-{{ checksum "package.json" }}
          paths:
            - node_modules
      - run: touch storage/testing.sqlite

      - run: php artisan migrate --env=testing --database=sqlite_testing --force
      - run: ./vendor/bin/phpunit

有人遇到类似的问题吗? 我是CI的新手,所以我怀疑我以某种方式弄乱了配置。 干杯。

1 个答案:

答案 0 :(得分:3)

该类的名称为Uuid,将其导入为use Ramsey\Uuid\Uuid