4 * This file is part of the Symfony package.
6 * (c) Fabien Potencier <fabien@symfony.com>
8 * For the full copyright and license information, please view the LICENSE
9 * file that was distributed with this source code.
12 namespace Symfony\Component\Serializer\Tests\Annotation;
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Serializer\Annotation\MaxDepth;
18 * @author Kévin Dunglas <dunglas@gmail.com>
20 class MaxDepthTest extends TestCase
23 * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
24 * @expectedExceptionMessage Parameter of annotation "Symfony\Component\Serializer\Annotation\MaxDepth" should be set.
26 public function testNotSetMaxDepthParameter()
28 new MaxDepth(array());
31 public function provideInvalidValues()
42 * @dataProvider provideInvalidValues
44 * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
45 * @expectedExceptionMessage Parameter of annotation "Symfony\Component\Serializer\Annotation\MaxDepth" must be a positive integer.
47 public function testNotAnIntMaxDepthParameter($value)
49 new MaxDepth(array('value' => $value));
52 public function testMaxDepthParameters()
54 $maxDepth = new MaxDepth(array('value' => 3));
55 $this->assertEquals(3, $maxDepth->getMaxDepth());