8000 Issue-21617 Review fix · symfony/symfony@175bc90 · GitHub
[go: up one dir, main page]

Skip to content

Commit 175bc90

Browse files
committed
Issue-21617 Review fix
1 parent 3fd7f53 commit 175bc90

File tree

1 file changed

+8
-19
lines changed

1 file changed

+8
-19
lines changed

src/Symfony/Component/Serializer/Tests/Encoder/XmlEncoderTest.php

Lines changed: 8 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111

1212
namespace Symfony\Component\Serializer\Tests\Encoder;
1313

14-
use DateTime;
1514
use PHPUnit\Framework\TestCase;
1615
use Symfony\Component\Serializer\Encoder\XmlEncoder;
1716
use Symfony\Component\Serializer\Exception\UnexpectedValueException;
@@ -29,9 +28,6 @@ class XmlEncoderTest extends TestCase
2928
*/
3029
private $encoder;
3130

32-
/**
33-
* @var string
34-
*/
3531
private $exampleDateTimeString = '2017-02-19T15:16:08+0300';
3632

3733
protected function setUp()
@@ -535,40 +531,33 @@ protected function getObject()
535531
return $obj;
536532
}
537533

538-
/**
539-
* @test
540-
*/
541534
public function testEncodeXmlWithBoolValue()
542535
{
543-
$expectedXml = '<?xml version="1.0"?>
536+
$expectedXml = <<<'XML'
537+
<?xml version="1.0"?>
544538
<response><foo>1</foo><bar>0</bar></response>
545-
';
539+
540+
XML;
546541

547542
$actualXml = $this->encoder->encode(array('foo' => true, 'bar' => false), 'xml');
548543

549544
$this->assertEquals($expectedXml, $actualXml);
550545
}
551546

552-
/**
553-
* @test
554-
*/
555547
public function testEncodeXmlWithDateTimeObjectValue()
556548
{
557549
$xmlEncoder = $this->createXmlEncoderWithDateTimeNormalizer();
558550

559-
$actualXml = $xmlEncoder->encode(array('dateTime' => new DateTime($this->exampleDateTimeString)), 'xml');
551+
$actualXml = $xmlEncoder->encode(array('dateTime' => new \DateTime($this->exampleDateTimeString)), 'xml');
560552

561553
$this->assertEquals($this->createXmlWithDateTime(), $actualXml);
562554
}
563555

564-
/**
565-
* @test
566-
*/
567556
public function testEncodeXmlWithDateTimeObjectField()
568557
{
569558
$xmlEncoder = $this->createXmlEncoderWithDateTimeNormalizer();
570559

571-
$actualXml = $xmlEncoder->encode(array('foo' => array('@dateTime' => new DateTime($this->exampleDateTimeString))), 'xml');
560+
$actualXml = $xmlEncoder->encode(array('foo' => array('@dateTime' => new \DateTime($this->exampleDateTimeString))), 'xml');
572561

573562
$this->assertEquals($this->createXmlWithDateTimeField(), $actualXml);
574563
}
@@ -595,13 +584,13 @@ private function createMockDateTimeNormalizer()
595584
$mock
596585
->expects($this->once())
597586
->method('normalize')
598-
->with(new DateTime($this->exampleDateTimeString), 'xml', array())
587+
->with(new \DateTime($this->exampleDateTimeString), 'xml', array())
599588
->willReturn($this->exampleDateTimeString);
600589

601590
$mock
602591
->expects($this->once())
603592
->method('supportsNormalization')
604-
->with(new DateTime($this->exampleDateTimeString), 'xml')
593+
->with(new \DateTime($this->exampleDateTimeString), 'xml')
605594
->willReturn(true);
606595

607596
return $mock;

0 commit comments

Comments
 (0)
0