在phpUnit中测试类时,会抛出此错误:
1) TableTest::testGetTableInputForm
opendir(./views/img/tables): failed to open dir: No such file or directory
该文件是可访问的,该类正在生产中。
如果我直接在testclass中调用opendir(),它将抛出相同的错误。如果我将绝对路径提供给opendir(),phpunit中的测试将冻结。
此行为还显示以root身份运行测试。
甚至可以用phpunit测试opendir()吗?
phpunit config:
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="http://schema.phpunit.de/3.7/phpunit.xsd"
backupGlobals="false"
backupStaticAttributes="false"
beStrictAboutTestsThatDoNotTestAnything="false"
beStrictAboutOutputDuringTests="false"
checkForUnintentionallyCoveredCode="false"
bootstrap="/external_data/jenkins/jenkins-home/jobs/admin/workspace/test/bootstrap.php"
cacheTokens="false"
colors="false"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
forceCoversAnnotation="false"
mapTestClassNameToCoveredClassName="false"
printerClass="PHPUnit_TextUI_ResultPrinter"
processIsolation="false"
stopOnError="false"
stopOnFailure="false"
stopOnIncomplete="false"
stopOnSkipped="false"
testSuiteLoaderFile="phpunit/src/Runner/StandardTestSuiteLoader.php"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60"
strict="true"
verbose="true"