审查器:如何排除phpunit(或包含api密钥的未提交文件?)

时间:2018-06-19 20:41:08

标签: php phpunit scrutinizer

在我的phpunit测试中,我require_onceapi_key.php当然在我的.gitignore(它包含我自己的api密钥)中。

<?php
namespace Domoticzapi;

use PHPUnit\Framework\TestCase;

require_once('api_key.php');

class ClientTest extends TestCase {
}

审查员抱怨

PHP Warning:  require_once(api_key.php): failed to open stream: No such file or directory in /home/scrutinizer/build/tests/Domoticzapi/ClientTest.php on line 6

如何排除此检查?还是有最好的方法(除了我不想使用的环境变量之外)?

1 个答案:

答案 0 :(得分:1)

AFAIK,您需要在scrutinizer-ci配置文件上设置测试命令以仅运行所需的套件测试,或者提供新的phpunit配置而不包含包含需要api_key.php的那些测试的套件

请参阅: How to run a specific phpunit xml testsuite? https://scrutinizer-ci.com/docs/build/running_tests_in_parallel