Fixed nested messaging for grouped exceptions.

This commit is contained in:
Alexandre 2011-08-10 23:05:35 -03:00
parent 00b4c24c19
commit cb6a14e02e
2 changed files with 14 additions and 2 deletions

View file

@ -44,12 +44,14 @@ class AbstractGroupedException extends AbstractNestedException
public function getTemplate()
{
if (!empty($this->template))
$parentTemplate = parent::getTemplate();
if (!empty($this->template) && $this->template != $parentTemplate)
return $this->template;
if (1 === count($this->related))
return current($this->related)->getTemplate();
else
return parent::getTemplate();
return $parentTemplate;
}
}

View file

@ -39,6 +39,16 @@ class ArrTest extends \PHPUnit_Framework_TestCase
array(array(1, 2, 3)),
array(new \ArrayObject),
);
$validator = v::alnum()->length(1,10);
$validator = new \Respect\Validation\Rules\AllOf(
new Respect\Validation\Rules\Alnum(),
new Respect\Validation\Rules\Length(1,10)
);
}
public function providerForNotArray()