Skip to content

Commit

Permalink
minor #20523 [Serializer] Improve test coverage of the MaxDepth annot…
Browse files Browse the repository at this point in the history
…ation (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
  • Loading branch information
fabpot committed Nov 15, 2016
2 parents 30e83dc + 5311696 commit a813cb7
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions src/Symfony/Component/Serializer/Tests/Annotation/MaxDepthTest.php
Expand Up @@ -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
*/
Expand All @@ -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());
}
}

0 comments on commit a813cb7

Please sign in to comment.