Skip to content

Commit a775f10

Browse files
committed
Fix metadata serialization. Add tests.
1 parent b1f39f7 commit a775f10

File tree

6 files changed

+76
-1
lines changed

6 files changed

+76
-1
lines changed

Mapping/AttributeMetadata.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -277,7 +277,8 @@ public function __sleep()
277277
'readable',
278278
'writable',
279279
'required',
280-
'link',
280+
'normalizationLink',
281+
'denormalizationLink',
281282
'iri',
282283
'identifier',
283284
];

Tests/Behat/TestBundle/Serializer/NameConverter/CustomConverter.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the DunglasApiBundle package.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Dunglas\ApiBundle\Tests\Behat\TestBundle\Serializer\NameConverter;
413

514
use Symfony\Component\Serializer\NameConverter\CamelCaseToSnakeCaseNameConverter;

Tests/Doctrine/Orm/DateFilterTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the DunglasApiBundle package.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Dunglas\ApiBundle\Tests\Doctrine\Orm;
413

514
use Doctrine\Common\Persistence\ManagerRegistry;

Tests/Doctrine/Orm/OrderFilterTest.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,14 @@
11
<?php
22

3+
/*
4+
* This file is part of the DunglasApiBundle package.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
7+
*
8+
* For the full copyright and license information, please view the LICENSE
9+
* file that was distributed with this source code.
10+
*/
11+
312
namespace Dunglas\ApiBundle\Tests\Doctrine\Orm;
413

514
use Doctrine\Common\Persistence\ManagerRegistry;
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
<?php
2+
3+
/*
4+
* This file is part of the DunglasApiBundle package.
5+
*
6+
* (c) Kévin Dunglas <[email protected]>
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 Dunglas\ApiBundle\Tests\Doctrine\Mapping;
13+
14+
use Dunglas\ApiBundle\Mapping\AttributeMetadata;
15+
16+
/**
17+
* @author Kévin Dunglas <[email protected]>
18+
*/
19+
class AttributeMetadataTest extends \PHPUnit_Framework_TestCase
20+
{
21+
public function testSerialize()
22+
{
23+
$attributeMetadata = new AttributeMetadata('test');
24+
$serialized = serialize($attributeMetadata);
25+
26+
$this->assertEquals($attributeMetadata, unserialize($serialized));
27+
}
28+
}

Tests/Mapping/ClassMetadataTest.php

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
<?php
2+
3+
namespace Dunglas\ApiBundle\Tests\Doctrine\Mapping;
4+
5+
use Dunglas\ApiBundle\Mapping\ClassMetadata;
6+
7+
/**
8+
* @author Kévin Dunglas <[email protected]>
9+
*/
10+
class ClassMetadataTest extends \PHPUnit_Framework_TestCase
11+
{
12+
public function testSerialize()
13+
{
14+
$classMetadata = new ClassMetadata('test');
15+
$serialized = serialize($classMetadata);
16+
17+
$this->assertEquals($classMetadata, unserialize($serialized));
18+
}
19+
}

0 commit comments

Comments
 (0)