dreamin' blog

PHPUnit DBUnitのカラムデータを取得する場合

phpunitのエクステンションDBUnitを使用しているときに、
テーブルの値を取得する場合はこれ。

<script src="https://gist.github.com/koheisg/1659ea1cf9339997540b.js"></script>

| 12 |

$queryTable = $this->getConnection()->createQueryTable('TABLE', 'SELECT * FROM TABLE');$queryTable->getTable('TABLE_NAME')->getValue(0,'id');

|

view raw gistfile1.php hosted with ❤ by GitHub

[ドキュメントやphpdocを見ると](http://phpunit.sourcearchive.com/documentation/3.2.16/interfacePHPUnit Extensions Database DataSet ITable_a011fc74ecbdc8f5632e7d66c74013568.html#a011fc74ecbdc8f5632e7d66c74013568)、columnはintって書いてあるけど、カラム名をstringで受けるっぽい。嘘つき。。