我的 CircleCI 测试由于缺少依赖项而失败,即使我的本地测试通过得很好:
1) TestsFeatureNetworkedObjectRegistrationTest::itRegistersNetworkedObjects
Error: Class 'RamseyUuidUUID' not found
依赖项在测试类中导入:
use AppModelsUser;
use AppModelsNetworkedObjectAbility;
use RamseyUuidUUID;
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 的新手,所以我怀疑我以某种方式搞砸了配置。干杯。
类的名称是Uuid
,导入为use RamseyUuidUuid
。