<?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%3A8.6</id>
	<title>PHPUnitManual:8.6 - 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%3A8.6"/>
	<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=PHPUnitManual:8.6&amp;action=history"/>
	<updated>2026-05-02T09:42:54Z</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:8.6&amp;diff=3402&amp;oldid=prev</id>
		<title>Onionmixer: PHPUnit 8.6 Connection API 페이지 추가</title>
		<link rel="alternate" type="text/html" href="https://trans.onionmixer.net/wiki/index.php?title=PHPUnitManual:8.6&amp;diff=3402&amp;oldid=prev"/>
		<updated>2013-07-02T08:38:52Z</updated>

		<summary type="html">&lt;p&gt;PHPUnit 8.6 Connection API 페이지 추가&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;;8.6 Connection API&lt;br /&gt;
&lt;br /&gt;
Connection 인터페이스에는, 3종류의 흥미로운 메소드가 준비되어 있습니다. 이 인터페이스는 데이터베이스 테스트 케이스의 getConnection() 메소드를 반환합니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
interface PHPUnit_Extensions_Database_DB_IDatabaseConnection&lt;br /&gt;
{&lt;br /&gt;
    public function createDataSet(Array $tableNames = NULL);&lt;br /&gt;
    public function createQueryTable($resultName, $sql);&lt;br /&gt;
    public function getRowCount($tableName, $whereClause = NULL);&lt;br /&gt;
&lt;br /&gt;
    // ...&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
1. createDataSet() 메소드는, Database (DB) dataset 을 작성합니다. 이는 &amp;quot;dataset 의 구현&amp;quot; 절에서 설명한 것입니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class ConnectionTest extends PHPUnit_Extensions_Database_TestCase&lt;br /&gt;
{&lt;br /&gt;
    public function testCreateDataSet()&lt;br /&gt;
    {&lt;br /&gt;
        $tableNames = array(&amp;#039;guestbook&amp;#039;);&lt;br /&gt;
        $dataSet = $this-&amp;gt;getConnection()-&amp;gt;createDataSet();&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
2. createQueryTable() 메소드를 사용하여 QuryTable 인스턴스를 만들 수 있습니다. 인수로는 결과의 이름과 SQL query 를 넘깁니다. 이는 다음 절 (데이터베이스 검증 API) 에서 설명할 결과나 테이블의 검증에 유용한 메소드입니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class ConnectionTest extends PHPUnit_Extensions_Database_TestCase&lt;br /&gt;
{&lt;br /&gt;
    public function testCreateQueryTable()&lt;br /&gt;
    {&lt;br /&gt;
        $tableNames = array(&amp;#039;guestbook&amp;#039;);&lt;br /&gt;
        $queryTable = $this-&amp;gt;getConnection()-&amp;gt;createQueryTable(&amp;#039;guestbook&amp;#039;, &amp;#039;SELECT * FROM guestbook&amp;#039;);&lt;br /&gt;
    }&lt;br /&gt;
}&lt;br /&gt;
&amp;lt;/syntaxhighlight&amp;gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
3. getRowCount() 는 테이블 안의 row 수를 간단히 얻기 위한 메소드입니다. 옵션으로 where 구문을 사용한 필터링도 가능합니다. 이를 이용하여 간단한 동일성 검증도 가능합니다.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;syntaxhighlight lang=&amp;quot;php&amp;quot;&amp;gt;&lt;br /&gt;
class ConnectionTest extends PHPUnit_Extensions_Database_TestCase&lt;br /&gt;
{&lt;br /&gt;
    public function testGetRowCount()&lt;br /&gt;
    {&lt;br /&gt;
        $this-&amp;gt;assertEquals(2, $this-&amp;gt;getConnection()-&amp;gt;getRowCount(&amp;#039;guestbook&amp;#039;));&lt;br /&gt;
    }&lt;br /&gt;
}&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>