<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://trans.onionmixer.net/wiki/index.php?action=history&amp;feed=atom&amp;title=PHPUnitManual%3A16.2</id>
	<title>PHPUnitManual:16.2 - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://trans.onionmixer.net/wiki/index.php?action=history&amp;feed=atom&amp;title=PHPUnitManual%3A16.2"/>
	<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=PHPUnitManual:16.2&amp;action=history"/>
	<updated>2026-05-02T14:01:50Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.43.3</generator>
	<entry>
		<id>https://trans.onionmixer.net/wiki/index.php?title=PHPUnitManual:16.2&amp;diff=3437&amp;oldid=prev</id>
		<title>Onionmixer: PHPUnit 16.2 Test case 클래스로부터 클래스 skeleton 생성 페이지 추가</title>
		<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=PHPUnitManual:16.2&amp;diff=3437&amp;oldid=prev"/>
		<updated>2013-07-04T09:27:07Z</updated>

		<summary type="html">&lt;p&gt;PHPUnit 16.2 Test case 클래스로부터 클래스 skeleton 생성 페이지 추가&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;;16.2 Test case 클래스로부터 클래스 skeleton 생성&lt;br /&gt;
&lt;br /&gt;
테스트 주도 개발 ( 제12장 을 참조하세요) 에서는 테스트를 먼저 작성한 뒤에 테스트 대상 코드를 작성하게 됩니다. PHPUnit 에서는 test case 클래스를 기반으로 클래스의 skeleton 을 생성할 수 있습니다.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
변환 규칙에 따라, Unit 클래스의 테스트는 UnitTest 클래스가 됩니다. 이 test case 클래스의 소스를 검색하여, Unit 클래스의 오브젝트를 참조하는 변수를 찾은 뒤, 해당 오브젝트가 어떤 메소드를 호출하는지를 조사합니다. 이 과정의 예를 예16.4 &amp;quot;생성된 BowlingGame 클래스의 skeleton&amp;quot; 을 통해 살펴 봅시다. 이 skeleton 은 예16.3 &amp;quot;BowlingGame 클래스&amp;quot; 의 분석 결과를 바탕으로 생성된 것입니다.&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
예16.3 BowlingGameTest 클래스&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
class BowlingGameTest extends PHPUnit_Framework_TestCase&lt;br /&gt;
{&lt;br /&gt;
    protected $game;&lt;br /&gt;
 &lt;br /&gt;
    protected function setUp()&lt;br /&gt;
    {&lt;br /&gt;
        $this-&amp;gt;game = new BowlingGame;&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    protected function rollMany($n, $pins)&lt;br /&gt;
    {&lt;br /&gt;
        for ($i = 0; $i &amp;lt; $n; $i++) {&lt;br /&gt;
            $this-&amp;gt;game-&amp;gt;roll($pins);&lt;br /&gt;
        }&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    public function testScoreForGutterGameIs0()&lt;br /&gt;
    {&lt;br /&gt;
        $this-&amp;gt;rollMany(20, 0);&lt;br /&gt;
        $this-&amp;gt;assertEquals(0, $this-&amp;gt;game-&amp;gt;score());&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
phpunit-skelgen --class BowlingGameTest&lt;br /&gt;
PHPUnit Skeleton Generator 1.0.0 by Sebastian Bergmann.&lt;br /&gt;
&lt;br /&gt;
Wrote skeleton for &amp;quot;BowlingGame&amp;quot; to &amp;quot;./BowlingGame.php&amp;quot;.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
예16.4 생성된 BowlingGame 클래스의 skeleton&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
&amp;lt;?php&lt;br /&gt;
/**&lt;br /&gt;
 * Generated by PHPUnit_SkeletonGenerator on 2012-01-09 at 16:55:58.&lt;br /&gt;
 */&lt;br /&gt;
class BowlingGame&lt;br /&gt;
{&lt;br /&gt;
    /**&lt;br /&gt;
     * @todo Implement roll().&lt;br /&gt;
     */&lt;br /&gt;
    public function roll()&lt;br /&gt;
    {&lt;br /&gt;
        // Remove the following line when you implement this method.&lt;br /&gt;
        throw new RuntimeException(&amp;#039;Not yet implemented.&amp;#039;);&lt;br /&gt;
    }&lt;br /&gt;
 &lt;br /&gt;
    /**&lt;br /&gt;
     * @todo Implement score().&lt;br /&gt;
     */&lt;br /&gt;
    public function score()&lt;br /&gt;
    {&lt;br /&gt;
        // Remove the following line when you implement this method.&lt;br /&gt;
        throw new RuntimeException(&amp;#039;Not yet implemented.&amp;#039;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
?&amp;gt;&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
작성된 클래스의 대한 테스트의 실행 결과는 다음과 같습니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;text&amp;quot;&amp;gt;&lt;br /&gt;
phpunit --bootstrap BowlingGame.php BowlingGameTest&lt;br /&gt;
PHPUnit 3.7.0 by Sebastian Bergmann.&lt;br /&gt;
&lt;br /&gt;
E&lt;br /&gt;
&lt;br /&gt;
Time: 0 seconds, Memory: 3.50Mb&lt;br /&gt;
&lt;br /&gt;
There was 1 error:&lt;br /&gt;
&lt;br /&gt;
1) BowlingGameTest::testScoreForGutterGameIs0&lt;br /&gt;
RuntimeException: Not yet implemented.&lt;br /&gt;
&lt;br /&gt;
/home/sb/BowlingGame.php:13&lt;br /&gt;
/home/sb/BowlingGameTest.php:14&lt;br /&gt;
/home/sb/BowlingGameTest.php:20&lt;br /&gt;
&lt;br /&gt;
FAILURES!&lt;br /&gt;
Tests: 1, Assertions: 0, Errors: 1.&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
==Notes==&lt;br /&gt;
&amp;lt;references /&amp;gt;&lt;br /&gt;
&lt;br /&gt;
[[Category:PHPUnitManual]]&lt;/div&gt;</summary>
		<author><name>Onionmixer</name></author>
	</entry>
</feed>