/**
  * @return EntityDescriptor
  */
 public function get()
 {
     if (null == $this->entityDescriptor) {
         $this->entityDescriptor = new EntityDescriptor();
         $deserializationContext = new DeserializationContext();
         $deserializationContext->getDocument()->load($this->filename);
         $this->entityDescriptor->deserialize($deserializationContext->getDocument()->firstChild, $deserializationContext);
     }
     return $this->entityDescriptor;
 }
 public function test__deserialize_formatted_certificate()
 {
     $context = new DeserializationContext();
     $context->getDocument()->load(__DIR__ . '/../../../../../../resources/sample/EntityDescriptor/ed01-formatted-certificate.xml');
     $ed = new EntityDescriptor();
     $ed->deserialize($context->getDocument()->firstChild, $context);
     $this->assertNotNull($ed->getFirstIdpSsoDescriptor());
     $arr = $ed->getFirstIdpSsoDescriptor()->getAllKeyDescriptors();
     $this->assertCount(1, $arr);
     /** @var KeyDescriptor $kd */
     $kd = array_shift($arr);
     $crt = openssl_x509_parse($kd->getCertificate()->toPem());
     $this->assertEquals('idp.testshib.org', $crt['subject']['CN']);
 }