mirror of
https://github.com/Respect/Validation.git
synced 2024-06-27 17:50:13 +02:00
Added {{input}} param on AbstractRule
This commit is contained in:
parent
e635db4a19
commit
67c789fa92
|
@ -192,7 +192,7 @@ You can also set runtime templates for those found messages:
|
|||
} catch (\InvalidArgumentException $e) {
|
||||
$messages = $e->findMessages(
|
||||
'author.username.noWhitespace' => 'Author username must not have any whitespace',
|
||||
'title' => 'Article title is invalid.'
|
||||
'title' => 'Article title is invalid. You provided {{input}}'
|
||||
);
|
||||
}
|
||||
|
||||
|
|
|
@ -44,7 +44,9 @@ abstract class AbstractRule implements Validatable
|
|||
$exception = $this->createException();
|
||||
$input = ValidationException::stringify($input);
|
||||
$name = $this->getName() ? : "\"$input\"";
|
||||
$params = array_merge($extraParams, get_object_vars($this));
|
||||
$params = array_merge(
|
||||
$extraParams, get_object_vars($this), compact('input')
|
||||
);
|
||||
$exception->configure($name, $params);
|
||||
if (!is_null($this->template))
|
||||
$exception->setTemplate($this->template);
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
<active>yes</active>
|
||||
</lead>
|
||||
<date>2011-04-29</date>
|
||||
<time>16:00:26</time>
|
||||
<time>16:17:13</time>
|
||||
<version>
|
||||
<release>0.2</release>
|
||||
<api>0.2</api>
|
||||
|
@ -75,7 +75,7 @@
|
|||
<file baseinstalldir="Respect/Validation" md5sum="59ffa243ffc76998c041121a67910e49" name="Exceptions/ZendException.php" role="php" />
|
||||
<file baseinstalldir="Respect/Validation" md5sum="e66388c3d06a5ae83d30fa03552b0bcc" name="Rules/AbstractComposite.php" role="php" />
|
||||
<file baseinstalldir="Respect/Validation" md5sum="0b4dbaf3ec8a99992122776ab0cbaf04" name="Rules/AbstractRelated.php" role="php" />
|
||||
<file baseinstalldir="Respect/Validation" md5sum="538ed692251e1a2593c1cd96534b075a" name="Rules/AbstractRule.php" role="php" />
|
||||
<file baseinstalldir="Respect/Validation" md5sum="ded7033264e9e3ff74cd5cf22704dc28" name="Rules/AbstractRule.php" role="php" />
|
||||
<file baseinstalldir="Respect/Validation" md5sum="3b6e284d165b2934650214b9af3422dc" name="Rules/AllOf.php" role="php" />
|
||||
<file baseinstalldir="Respect/Validation" md5sum="ba19b564226ca821e5ad20a094d46ae7" name="Rules/Alnum.php" role="php" />
|
||||
<file baseinstalldir="Respect/Validation" md5sum="8d75ac998a6f9565d336414773137588" name="Rules/Alpha.php" role="php" />
|
||||
|
|
|
@ -118,13 +118,12 @@ class AbstractNestedExceptionTest extends \PHPUnit_Framework_TestCase
|
|||
$messages = $e->findMessages(
|
||||
array(
|
||||
'allOf' => 'Invalid {{name}}',
|
||||
'first_name.length' => 'Invalid length for {{name}}'
|
||||
'first_name.length' => 'Invalid length for {{name}} {{input}}'
|
||||
)
|
||||
);
|
||||
$this->assertEquals($messages['allOf'],
|
||||
'Invalid Validation Form');
|
||||
$this->assertEquals($messages['allOf'], 'Invalid Validation Form');
|
||||
$this->assertEquals($messages['first_name_length'],
|
||||
'Invalid length for "fiif"');
|
||||
'Invalid length for "fiif" fiif');
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue