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\Mapping;
14 use Symfony\Component\Serializer\Mapping\AttributeMetadata;
15 use Symfony\Component\Serializer\Mapping\ClassMetadata;
18 * @author Kévin Dunglas <dunglas@gmail.com>
20 class TestClassMetadataFactory
22 public static function createClassMetadata($withParent = false, $withInterface = false)
24 $expected = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy');
26 $foo = new AttributeMetadata('foo');
28 $expected->addAttributeMetadata($foo);
30 $bar = new AttributeMetadata('bar');
33 $bar->addGroup('name_converter');
34 $expected->addAttributeMetadata($bar);
36 $fooBar = new AttributeMetadata('fooBar');
37 $fooBar->addGroup('a');
38 $fooBar->addGroup('b');
39 $fooBar->addGroup('name_converter');
40 $expected->addAttributeMetadata($fooBar);
42 $symfony = new AttributeMetadata('symfony');
43 $expected->addAttributeMetadata($symfony);
46 $kevin = new AttributeMetadata('kevin');
47 $kevin->addGroup('a');
48 $expected->addAttributeMetadata($kevin);
50 $coopTilleuls = new AttributeMetadata('coopTilleuls');
51 $coopTilleuls->addGroup('a');
52 $coopTilleuls->addGroup('b');
53 $expected->addAttributeMetadata($coopTilleuls);
57 $symfony->addGroup('a');
58 $symfony->addGroup('name_converter');
61 // load reflection class so that the comparison passes
62 $expected->getReflectionClass();
67 public static function createXmlCLassMetadata()
69 $expected = new ClassMetadata('Symfony\Component\Serializer\Tests\Fixtures\GroupDummy');
71 $foo = new AttributeMetadata('foo');
72 $foo->addGroup('group1');
73 $foo->addGroup('group2');
74 $expected->addAttributeMetadata($foo);
76 $bar = new AttributeMetadata('bar');
77 $bar->addGroup('group2');
78 $expected->addAttributeMetadata($bar);