gpt4 book ai didi

php - Travis 自动加载器 PhpUnit

转载 作者:搜寻专家 更新时间:2023-10-31 21:08:40 24 4
gpt4 key购买 nike

这是我的 PHPUnit 配置文件。出于某种原因,它适用于我的本地环境,但是当我尝试使用 travis 时,它说由于某种原因它找不到类。

并且 bootstrap="./vendor/autoload.php"在 Travis 机器上没有找到

   <?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/4.2/phpunit.xsd"
backupGlobals="false"
verbose="true"
bootstrap="./vendor/autoload.php">
<testsuite name="aaaa">
<directory suffix="Test.php">tests</directory>
</testsuite>

<logging>
<log type="coverage-html" target="build/coverage"/>
</logging>

<filter>
<whitelist processUncoveredFilesFromWhitelist="true">
<directory suffix=".php">src</directory>
</whitelist>
</filter>
</phpunit>

最佳答案

如果您使用的是 composer,它会将自动加载器和任何依赖项安装到 vendor 目录。通常将 vendor 目录放入您的 .gitignore 文件中。

这意味着当 travis check out 你的项目时,它不会有 vendor 目录。在运行测试之前,您需要运行 composer 来安装依赖项 和自动加载器。

确保提交您的 composer.jsoncomposer.lock 文件并将其放入您的 .travis.yml:

install: composer install

关于php - Travis 自动加载器 PhpUnit,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/27139723/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com