348ad14619148de3b1fd2b984518c2b88b746872
[yaffs-website] / vendor / symfony / serializer / Tests / Annotation / GroupsTest.php
1 <?php
2
3 /*
4  * This file is part of the Symfony package.
5  *
6  * (c) Fabien Potencier <fabien@symfony.com>
7  *
8  * For the full copyright and license information, please view the LICENSE
9  * file that was distributed with this source code.
10  */
11
12 namespace Symfony\Component\Serializer\Tests\Annotation;
13
14 use PHPUnit\Framework\TestCase;
15 use Symfony\Component\Serializer\Annotation\Groups;
16
17 /**
18  * @author Kévin Dunglas <dunglas@gmail.com>
19  */
20 class GroupsTest extends TestCase
21 {
22     /**
23      * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
24      */
25     public function testEmptyGroupsParameter()
26     {
27         new Groups(array('value' => array()));
28     }
29
30     /**
31      * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
32      */
33     public function testNotAnArrayGroupsParameter()
34     {
35         new Groups(array('value' => 'coopTilleuls'));
36     }
37
38     /**
39      * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
40      */
41     public function testInvalidGroupsParameter()
42     {
43         new Groups(array('value' => array('a', 1, new \stdClass())));
44     }
45
46     public function testGroupsParameters()
47     {
48         $validData = array('a', 'b');
49
50         $groups = new Groups(array('value' => $validData));
51         $this->assertEquals($validData, $groups->getGroups());
52     }
53 }