8000 [Serializer][XmlEncoder] Allow removing empty tags in generated XML by amoiraud · Pull Request #20524 · symfony/symfony · GitHub
[go: up one dir, main page]

Skip to content

[Serializer][XmlEncoder] Allow removing empty tags in generated XML #20524

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Add test method without "remove_empty_tags" context option
  • Loading branch information
amoiraud committed Nov 15, 2016
commit 3a6fc1dd12750c247fc308ad4b45b225bcc2f77b
10 changes: 10 additions & 0 deletions src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,16 @@ public function testEncodeRemovingEmptyTags()
$this->assertSame($expected, $this->encoder->encode($array, 'xml', $context));
}

public function testEncodeNotRemovingEmptyTags()
{
$array = array('person' => array('firstname' => 'Peter', 'lastname' => null));

$expected = '<?xml version="1.0"?>'."\n".
'<response><person><firstname>Peter</firstname><lastname/></person></response>'."\n";

$this->assertSame($expected, $this->encoder->encode($array, 'xml'));
}

public function testContext()
{
$array = array('person' => array('name' => 'George Abitbol'));
Expand Down
0