minor #20523 [Serializer] Improve test coverage of the MaxDepth annotation (dunglas)

This PR was merged into the 3.1 branch.

Discussion
----------

[Serializer] Improve test coverage of the MaxDepth annotation

| Q             | A
| ------------- | ---
| Branch?       | 3.1
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

Commits
-------

5311696 [Serializer] Improve test coverage of the MaxDepth annotation
This commit is contained in:
Fabien Potencier 2016-11-15 15:46:31 -05:00
commit a813cb7f76

View File

@ -18,6 +18,22 @@ use Symfony\Component\Serializer\Annotation\MaxDepth;
*/
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
*/
@ -28,9 +44,7 @@ class MaxDepthTest extends \PHPUnit_Framework_TestCase
public function testMaxDepthParameters()
{
$validData = 3;
$groups = new MaxDepth(array('value' => 3));
$this->assertEquals($validData, $groups->getMaxDepth());
$maxDepth = new MaxDepth(array('value' => 3));
$this->assertEquals(3, $maxDepth->getMaxDepth());
}
}