Download the PHP package iamapen/commentable-data-set without Composer
On this page you can find all versions of the php package iamapen/commentable-data-set. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.
Informations about the package commentable-data-set
dbunit Commentable DataSet
phpunit/dbunit 用の DataSet や Operation の詰め合わせ。
iamapen/excel-friendly-data-set の後継。
DBレコードを「1列目がコメントのCSV」で表現するための CsvDataSet など。
Install
UT用なので require --dev
になる。
手動で composer.json に書く場合
Usage
DataSet
DataSet/CommentableDataSet
CSVの左n列をコメント列扱いとして、無視する(取り込まない) 機能を持つ CsvDataSet。
テストデータに対してのコメント列として使える。
CSVの例
もちろん他の DataSet との比較もできる
DataSet/ExcelCsvDataSet (deprecated)
最初に作成した DataSet。
Excelで扱いやすい UTF-16-LE(+BOM) のCSVを UTF-8 に変換しながら取り込むもの。
現在は出番はないと思われる。
2007年作成当時は UTF-8 の CSVを満足に編集できるソフトが少ないという経緯で作られた。
しかし現在は LibreOffice-Calc 等のエディタでUTF8のCSVを容易に編集できるため、
わざわざExcel用に UTF-16 で保存しておくこともない。
以下、旧 README のまま。
Excelでは UTF-8 のcsvをまともに編集(とくに保存)ができないが、 UTF-16-LE(+BOM) にすれば「D&Dで開く」「Ctrl+S」で保存など比較的自然に編集でき、 テストデータにUnicode文字も使える。
代わりにテストコード内で UTF-16 -> UTF-8 変換が必要になるので、これを行う。
なおExcelからは"Unicode", sakuraエディタでは"Unicode", vimでは"utf16le", mbstringでは"UTF-16"で扱える。 新規CSV作成時はテキストエディタでUTF-16のファイルを作成してそれをExcelにD&Dするのが楽そう。
xxTest.php
Operation
Operation/MySqlBulkInsert
PHPUnit_Extensions_Database_Operation_Insert
のバルクインサート版。
MySQL専用。(一応SQLiteでも動く)
あまりに入力CSVが大きいと、max_allowed_packet
の制限にかかる可能性がある。これは課題。
注意点・課題
-
Operation/MySqlBulkInsert
- あまりに入力CSVが大きいと
max_allowed_packet
の制限にかかる可能性がある。
- あまりに入力CSVが大きいと
-
DataSet/ExcelCsvDataSet
- もはや非推奨。
UTF-8 で保存して、UTF-8 対応のエディタで編集するのがよい。例えば LibreOffice の Calc でできる。
Excelでやろうというのは、まともなエディタが存在しなかった時代の古いアプローチ。 - 文字コード変換をストリームでやったほうがいい
- もはや非推奨。
- 正式なプロダクトでの運用実績が少ないため、品質は趣味レベル。
バージョン
php | phpunit | dbunit | |
---|---|---|---|
5.0.x | 7.2+ | 8.2, 9.x | 5.x |
4.0.x | 7.1+ | 7.x | 4.x |
3.0.x | 7.0+ | 6.x | 3.x |
2.0.x | 5.4+, 7.0+ | 4.x, 5.x | 2.x |
1.2.x | 5.3+ | 3.x, 4.x | 1.x |
1.1.x | 5.3+ | 3.x, 4.x | 1.x |
1.0.x (EOL) | 5.3+ | 3.x | 1.x |