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\Groups;
18 * @author Kévin Dunglas <dunglas@gmail.com>
20 class GroupsTest extends TestCase
23 * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
25 public function testEmptyGroupsParameter()
27 new Groups(array('value' => array()));
31 * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
33 public function testNotAnArrayGroupsParameter()
35 new Groups(array('value' => 'coopTilleuls'));
39 * @expectedException \Symfony\Component\Serializer\Exception\InvalidArgumentException
41 public function testInvalidGroupsParameter()
43 new Groups(array('value' => array('a', 1, new \stdClass())));
46 public function testGroupsParameters()
48 $validData = array('a', 'b');
50 $groups = new Groups(array('value' => $validData));
51 $this->assertEquals($validData, $groups->getGroups());