我正在开发一个使用 Composer 引入包依赖项的 CakePHP 2.x 插件。我现在正在尝试使用蛋糕之友的Travis 包在插件存储库更新时自动运行我的单元测试。
据我所知,这不包括在我的供应商文件中加载所需的 Composer 自动加载文件。结果我的测试失败了,因为第三方包中定义的类丢失了。
如CakePHP 2 的高级安装中所述,我正在尝试将以下内容添加到bootstrap.php
:-
require APP . 'Vendor' . DS . 'autoload.php';
我试图通过before_script
我的.travis.yml
文件来附加bootstrap.php
:-
before_script:
- git clone https://github.com/FriendsOfCake/travis.git --depth 1 ../travis
- ../travis/before_script.sh
- echo "require APP . 'Vendor' . DS . 'autoload.php';" >> ../cakephp/app/Config/bootstrap.php
不幸的是,这失败了,因为APP . 'Vendor' . DS . 'autoload.php'
找不到文件。(我也尝试在 中查找文件APP . '..' . DS . 'Vendor' . DS . 'autoload.php'
)。
autoload.php
使用 Travis 安装 CakePHP 时Composer 文件位于何处?当我的测试在 Travis CI 上远程运行时,如何确保加载我的第三方包?