|
@@ -53,6 +53,7 @@ use JMS\Serializer\Tests\Fixtures\AccessorOrderChild;
|
|
|
use JMS\Serializer\Tests\Fixtures\AccessorOrderParent;
|
|
|
use JMS\Serializer\Tests\Fixtures\AccessorOrderMethod;
|
|
|
use JMS\Serializer\Tests\Fixtures\Author;
|
|
|
+use JMS\Serializer\Tests\Fixtures\Publisher;
|
|
|
use JMS\Serializer\Tests\Fixtures\AuthorList;
|
|
|
use JMS\Serializer\Tests\Fixtures\AuthorReadOnly;
|
|
|
use JMS\Serializer\Tests\Fixtures\BlogPost;
|
|
@@ -290,7 +291,7 @@ abstract class BaseSerializationTest extends \PHPUnit_Framework_TestCase
|
|
|
|
|
|
public function testBlogPost()
|
|
|
{
|
|
|
- $post = new BlogPost('This is a nice title.', $author = new Author('Foo Bar'), new \DateTime('2011-07-30 00:00', new \DateTimeZone('UTC')));
|
|
|
+ $post = new BlogPost('This is a nice title.', $author = new Author('Foo Bar'), new \DateTime('2011-07-30 00:00', new \DateTimeZone('UTC')), new Publisher('Bar Foo'));
|
|
|
$post->addComment($comment = new Comment($author, 'foo'));
|
|
|
|
|
|
$this->assertEquals($this->getContent('blog_post'), $this->serialize($post));
|
|
@@ -312,9 +313,10 @@ abstract class BaseSerializationTest extends \PHPUnit_Framework_TestCase
|
|
|
$objectConstructor = new InitializedBlogPostConstructor();
|
|
|
$this->serializer = new Serializer($this->factory, $this->handlerRegistry, $objectConstructor, $this->serializationVisitors, $this->deserializationVisitors, $this->dispatcher);
|
|
|
|
|
|
- $post = new BlogPost('This is a nice title.', $author = new Author('Foo Bar'), new \DateTime('2011-07-30 00:00', new \DateTimeZone('UTC')));
|
|
|
+ $post = new BlogPost('This is a nice title.', $author = new Author('Foo Bar'), new \DateTime('2011-07-30 00:00', new \DateTimeZone('UTC')), new Publisher('Bar Foo'));
|
|
|
|
|
|
$this->setField($post, 'author', null);
|
|
|
+ $this->setField($post, 'publisher', null);
|
|
|
|
|
|
$this->assertEquals($this->getContent('blog_post_unauthored'), $this->serialize($post, SerializationContext::create()->setSerializeNull(true)));
|
|
|
|