1
내 프로젝트의 구조는이 :phpunit을 오토로더 클래스
--/
--src
--tests
--phpunit.xml
--composer.json
나는 시험에서 src 폴더에서 내 수업을 자동 로딩을 위해 작곡가를 사용하고 싶습니다. 내 composer.json가 :
{
"name": "codewars/pack",
"description": "Codewars project",
"type": "project",
"require": {
"fxp/composer-asset-plugin": "^1.2.0",
"phpunit/phpunit": "5.5.*",
"phpunit/dbunit": "2.0.*"
},
"autoload": {
"psr-4": {"Source\\": "src/"
}
}
}
Autoloder 파일이 생성 :
<?php
// autoload_psr4.php @generated by Composer
$vendorDir = dirname(dirname(__FILE__));
$baseDir = dirname($vendorDir);
return array(
'Source\\' => array($baseDir . '/src'),
);
내 phpunit.xml :
<phpunit bootstrap="vendor/autoload.php">
<testsuites>
<testsuite name="Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
</phpunit>
그리고 내 테스트 파일 예 :
class Task2Test extends PHPUnit_Framework_TestCase
{
public function testTask2(){
$list=[1,3,5,9,11];
$this->assertEquals(7,\Source\findMissing($list));
$list=[1,5,7];
$this->assertEquals(3,\Source\findMissing($list));
}
}
그리고 내가 시험을 볼 때 정의되지 않은 기능 소스 \ findMissing()를 호출
이, 도와, 어떻게이 문제를 해결할 수 있습니다하십시오의 I는 다음과 같은 치명적인 오류 오류 얻을?