Test the legend
This commit is contained in:
parent
8cb4496806
commit
522e7f9032
3 changed files with 33 additions and 1 deletions
|
|
@ -89,6 +89,19 @@ class Validator
|
|||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the excepted legend
|
||||
*
|
||||
* @param array $legend Expected legend
|
||||
* @return Validator
|
||||
*/
|
||||
public function setExceptedLegend(array $legend)
|
||||
{
|
||||
$this->expectedLegend = $legend;
|
||||
|
||||
return $this;
|
||||
}
|
||||
|
||||
/**
|
||||
* Run the validation
|
||||
*/
|
||||
|
|
@ -98,6 +111,7 @@ class Validator
|
|||
return;
|
||||
}
|
||||
|
||||
$this->validateLegend();
|
||||
$this->validateDatas();
|
||||
$this->validateFields();
|
||||
|
||||
|
|
@ -105,6 +119,21 @@ class Validator
|
|||
$this->hasValidate = true;
|
||||
}
|
||||
|
||||
protected function validateLegend()
|
||||
{
|
||||
if (!$this->parser->getHasLegend()) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (null === $this->expectedLegend) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ($this->parser->getLegend() !== $this->expectedLegend) {
|
||||
$this->mergeErrorMessage('Invalid legend.', 1);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates datas
|
||||
*/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue