diff --git a/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php b/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php
index 88c7a1d8ea..b0ee6b3754 100644
--- a/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php
+++ b/core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php
@@ -3,6 +3,9 @@
 namespace Drupal\Tests\serialization\Unit\Encoder;
 
 use Drupal\serialization\Encoder\XmlEncoder;
+use Symfony\Component\Serializer\Encoder\XmlEncoder as BaseXmlEncoder;
+use Symfony\Component\Serializer\Normalizer\GetSetMethodNormalizer;
+use Symfony\Component\Serializer\Serializer;
 use Drupal\Tests\UnitTestCase;
 
 /**
@@ -31,7 +34,7 @@ class XmlEncoderTest extends UnitTestCase {
   protected $testArray = ['test' => 'test'];
 
   protected function setUp() {
-    $this->baseEncoder = $this->getMock('Symfony\Component\Serializer\Encoder\XmlEncoder');
+    $this->baseEncoder = $this->getMock(BaseXmlEncoder::class);
     $this->encoder = new XmlEncoder();
     $this->encoder->setBaseEncoder($this->baseEncoder);
   }
@@ -76,4 +79,23 @@ public function testDecode() {
     $this->assertEquals($this->testArray, $this->encoder->decode('test', 'test'));
   }
 
+   /**
+    * @covers ::getBaseEncoder
+    */
+  public function testDefaultEncoderHasSerializer() {
+     // The serializer should be set on the Drupal encoder, which should then
+     // set it on our default encoder.
+     $encoder = new XmlEncoder();
+     $serialzer = new Serializer([new GetSetMethodNormalizer()]);
+     $encoder->setSerializer($serialzer);
+     $base_encoder = $encoder->getBaseEncoder();
+     $this->assertInstanceOf(BaseXmlEncoder::class, $base_encoder);
+     // Test the encoder.
+     $base_encoder->encode(['a' => new TestObject()], 'xml');
+   }
+ }
+ class TestObject {
+  public function getA() {
+     return 'A';
+   }
 }
