X-Git-Url: http://www.aleph1.co.uk/gitweb/?p=yaffs-website;a=blobdiff_plain;f=vendor%2Fsymfony%2Fserializer%2FTests%2FAnnotation%2FMaxDepthTest.php;fp=vendor%2Fsymfony%2Fserializer%2FTests%2FAnnotation%2FMaxDepthTest.php;h=4554fc9905ca674a6f609ebdd9e2ab3be206a402;hp=0000000000000000000000000000000000000000;hb=9917807b03b64faf00f6a1f29dcb6eafc454efa5;hpb=aea91e65e895364e460983b890e295aa5d5540a5 diff --git a/vendor/symfony/serializer/Tests/Annotation/MaxDepthTest.php b/vendor/symfony/serializer/Tests/Annotation/MaxDepthTest.php new file mode 100644 index 000000000..4554fc990 --- /dev/null +++ b/vendor/symfony/serializer/Tests/Annotation/MaxDepthTest.php @@ -0,0 +1,57 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Serializer\Tests\Annotation; + +use PHPUnit\Framework\TestCase; +use Symfony\Component\Serializer\Annotation\MaxDepth; + +/** + * @author Kévin Dunglas + */ +class MaxDepthTest extends TestCase +{ + /** + * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException + * @expectedExceptionMessage Parameter of annotation "Symfony\Component\Serializer\Annotation\MaxDepth" should be set. + */ + public function testNotSetMaxDepthParameter() + { + new MaxDepth(array()); + } + + public function provideInvalidValues() + { + return array( + array(''), + array('foo'), + array('1'), + array(0), + ); + } + + /** + * @dataProvider provideInvalidValues + * + * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException + * @expectedExceptionMessage Parameter of annotation "Symfony\Component\Serializer\Annotation\MaxDepth" must be a positive integer. + */ + public function testNotAnIntMaxDepthParameter($value) + { + new MaxDepth(array('value' => $value)); + } + + public function testMaxDepthParameters() + { + $maxDepth = new MaxDepth(array('value' => 3)); + $this->assertEquals(3, $maxDepth->getMaxDepth()); + } +}