forked from deblan/csv-validator
Test the legend
This commit is contained in:
parent
8cb4496806
commit
522e7f9032
3 changed files with 33 additions and 1 deletions
|
|
@ -23,6 +23,9 @@ $validator->addFieldConstraint(0, new Email());
|
|||
// The second field must contain a date
|
||||
$validator->addFieldConstraint(1, new Date());
|
||||
|
||||
// Validate the legend
|
||||
$validator->setExceptedLegend(array('foo', 'bar', 'bim'));
|
||||
|
||||
// An line must contain 3 columns
|
||||
$validator->addDataConstraint(new Callback(function($data, ExecutionContextInterface $context) {
|
||||
if (count($data) !== 6) { // 6 because of the legend (3 fields * 2)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue