mirror of
https://github.com/Respect/Validation.git
synced 2024-06-29 02:30:06 +02:00
Merge branch '1.0'
This commit is contained in:
commit
78449ce9b0
|
@ -41,4 +41,10 @@ abstract class AbstractWrapper extends AbstractRule
|
|||
{
|
||||
return $this->getValidatable()->validate($input);
|
||||
}
|
||||
|
||||
public function setName($name)
|
||||
{
|
||||
$this->getValidatable()->setName($name);
|
||||
return parent::setName($name);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -93,4 +93,21 @@ class AbstractWrapperTest extends \PHPUnit_Framework_TestCase
|
|||
|
||||
$this->assertTrue($wrapper->check($input));
|
||||
}
|
||||
|
||||
public function testShouldPassNameOnToWrapped()
|
||||
{
|
||||
$name = 'Whatever';
|
||||
|
||||
$validatable = $this->getMock('Respect\Validation\Validatable');
|
||||
$validatable
|
||||
->expects($this->once())
|
||||
->method('setName')
|
||||
->with($name)
|
||||
->will($this->returnValue($validatable));
|
||||
|
||||
$wrapper = $this->getMockForAbstractClass('Respect\Validation\Rules\AbstractWrapper');
|
||||
$this->bindValidatable($wrapper, $validatable);
|
||||
|
||||
$this->assertSame($wrapper, $wrapper->setName($name));
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue