From 531169656e3e3901eedd869fa04b04d006f80aab Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?K=C3=A9vin=20Dunglas?= Date: Tue, 15 Nov 2016 08:36:22 +0100 Subject: [PATCH] [Serializer] Improve test coverage of the MaxDepth annotation --- .../Tests/Annotation/MaxDepthTest.php | 22 +++++++++++++++---- 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php b/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php index 2a51ffbe5d1c..5594cb5f1b9d 100644 --- a/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php +++ b/src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php @@ -18,6 +18,22 @@ */ 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 @@ public function testNotAnIntMaxDepthParameter() 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()); } }