PHPUnitManual:14.2

From 흡혈양파의 번역工房
Jump to navigation Jump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.
14.2 Code Block 의 무시

때로는 테스트할 수 없기 때문에 Code coverage 분석을 하는 동안 무시하고 싶은 코드 블럭이 있을 수 있습니다. PHPUnit 에서는 이를 위해서 @codeCoverageIgnore, @codeCoverageIgnoreStart 그리고 @codeCoverageIgnoreEnd 선언을 제공합니다. 사용 방법의 예가 예14.4 "@codeCoverageIgnore, @codeCoverageIgnoreStart 그리고 @codeCoverageIgnoreEnd 선언의 사용법" 에 나와 있습니다.


예14.4 @codeCoverageIgnore, @codeCoverageIgnoreStart 그리고 @codeCoverageIgnoreEnd 선언의 사용법

<?php
/**
 * @codeCoverageIgnore
 */
class Foo
{
    public function bar()
    {
    }
}
 
class Bar
{
    /**
     * @codeCoverageIgnore
     */
    public function foo()
    {
    }
}
 
if (FALSE) {
    // @codeCoverageIgnoreStart
    print '*';
    // @codeCoverageIgnoreEnd
}
?>


이 선언들을 사용하여, 무시하도록 지정된 행은, (실행되지 않더라도) 실행된 것으로 간주되어 강조 표시되지 않습니다.


Notes