[Serializer] Improve test coverage of the MaxDepth annotation
This commit is contained in:
parent
61fea5a3f1
commit
531169656e
@ -18,6 +18,22 @@ use Symfony\Component\Serializer\Annotation\MaxDepth;
|
|||||||
*/
|
*/
|
||||||
class MaxDepthTest extends \PHPUnit_Framework_TestCase
|
class MaxDepthTest extends \PHPUnit_Framework_TestCase
|
||||||
{
|
{
|
||||||
|
/**
|
||||||
|
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function testNotSetMaxDepthParameter()
|
||||||
|
{
|
||||||
|
new MaxDepth(array());
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
|
||||||
|
*/
|
||||||
|
public function testEmptyMaxDepthParameter()
|
||||||
|
{
|
||||||
|
new MaxDepth(array('value' => ''));
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
|
* @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
|
||||||
*/
|
*/
|
||||||
@ -28,9 +44,7 @@ class MaxDepthTest extends \PHPUnit_Framework_TestCase
|
|||||||
|
|
||||||
public function testMaxDepthParameters()
|
public function testMaxDepthParameters()
|
||||||
{
|
{
|
||||||
$validData = 3;
|
$maxDepth = new MaxDepth(array('value' => 3));
|
||||||
|
$this->assertEquals(3, $maxDepth->getMaxDepth());
|
||||||
$groups = new MaxDepth(array('value' => 3));
|
|
||||||
$this->assertEquals($validData, $groups->getMaxDepth());
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user