Ticket #526 (closed enhancement: fixed)
more flexible dataset filtering in dbunit
| Reported by: | daniel | Owned by: | mlively |
|---|---|---|---|
| Priority: | trivial | Milestone: | PHPUnit 3.4 |
| Component: | phpunit | Version: | |
| Keywords: | DbUnit | Cc: | |
| PHP Version: | 5.2.4 |
Description
Filtering a dataset is one of those features I use pretty often and it works pretty well. However there are cases, that some more robust dataset filtering would be more handy. Imagine having a table with 15 columns, while you want to only test 2 of them. AFAIK you have to exclude the other 13 by explicitly passing their names to PHPUnit_Extensions_Database_DataSet_DataSetFilter constructor or include all of them in your xml files (php dataset pretty please?:)) It would be much easier to exclude everything and include only the columns we need. So, instead of calling:
...DataSetFilter($dataset, array('tab1' => array('col1', 'col2',[...], 'col13')));
I could call the filter with e.g. additional param
...DataSetFilter($dataset, array('tab1' => '*'), array('tab1' => array('col14', 'col15')));
So in other words, exclude everything ('*') from table tab1, except col14 and col15. Of course, it's just an example how it could be much shorter than the current syntax. For now '*' works a bit different, but I don't see a problem to modify its behaviour in case the 3rd param is defined.
But regardless, any solution that would shorten the dataset filter code would be welcome
What are your thoughts about it?
Thanks
