1
& 보호 방법을 PhpUnit의 코드 커버리지 보고서에서 숨길 수 있습니까? 코드 커버리지 보고서에서 비공개 + 보호 된 메소드를 숨기시겠습니까?
나는 다른 사람들이 하나가 "간접적"을 테스트해야하지만 난 정말가 전화를받을 경우 치료 여부를 내가 나를 위해@covers
을 설정하는 것이 시간의 완전한 낭비라고 생각하지 않는다
것을 건의 알고 개인 유틸리티 방법. 은 여기 내 phpunit.xml
당신은 볼 필요가있는 경우 :
<phpunit
backupGlobals="false"
backupStaticAttributes="false"
bootstrap="vendor/autoload.php"
colors="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false"
syntaxCheck="false"
timeoutForSmallTests="1"
timeoutForMediumTests="10"
timeoutForLargeTests="60">
<testsuites>
<testsuite name="default">
<directory>./tests</directory>
<exclude>
<directory suffix=".php">./src/Internal</directory>
</exclude>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">./src</directory>
</whitelist>
</filter>
<logging>
<log type="coverage-html" target="./log/codeCoverage" charset="UTF-8" yui="true" highlight="true" lowUpperBound="50" highLowerBound="80"/>
<log type="testdox-html" target="./log/testdox.html"/>
</logging>
</phpunit>
이
음, 공용 메서드가 개인 메서드를 사용하는 경우 왜 제외 할 것입니까? 이것은 나에게 전혀 의미가 없습니다. :) – DonCallisto
@DonCallisto IMO 노력만큼 가치가 없습니다. 감소하는 수익. 단위 테스트는 출력이 정확한지 확인합니다. 코드 커버리지는 모든 다른 시나리오에 적용되는지 테스트합니다. 필자가 사설 유틸리티 메소드의 일부를 지나치게 일반화했다 할지라도, 필자는 실제로 lib 디렉토리의 모든 코드 행을 실행해야만 하는가? 나는 그렇게 생각하지 않는다. – mpen
음,이 경우에는 코드 커버리지를 끄십시오. 그렇지 않으면 public 메소드 imho에만 적용하는 것이 이해가되지 않습니다. – DonCallisto