/** * @test */ public function shouldLoadTestshibMetadata() { $doc = new \DOMDocument(); $doc->load(__DIR__ . '/../../../../../../../resources/sample/EntitiesDescriptor/testshib-providers.xml'); $ed = new EntitiesDescriptor(); $ed->loadFromXml($doc->firstChild); $arr = $ed->getAllEntityDescriptors(); $this->assertCount(2, $arr); $this->assertEquals('https://idp.testshib.org/idp/shibboleth', $arr[0]->getEntityID()); $this->assertCount(1, $arr[0]->getAllIdpSsoDescriptors()); $this->assertCount(0, $arr[0]->getAllSpSsoDescriptors()); $this->assertEquals('https://sp.testshib.org/shibboleth-sp', $arr[1]->getEntityID()); $this->assertCount(0, $arr[1]->getAllIdpSsoDescriptors()); $this->assertCount(1, $arr[1]->getAllSpSsoDescriptors()); }
/** * @test */ public function shouldReturnRecursivelyAllEntityDescriptors() { $esd1 = new EntitiesDescriptor(); $esd1->addItem(new EntityDescriptor('ed1')); $esd1->addItem(new EntityDescriptor('ed2')); $esd2 = new EntitiesDescriptor(); $esd2->addItem(new EntityDescriptor('ed3')); $esd1->addItem($esd2); $esd3 = new EntitiesDescriptor(); $esd3->addItem(new EntityDescriptor('ed4')); $esd2->addItem($esd3); $all = $esd1->getAllEntityDescriptors(); $this->assertCount(4, $all); $this->assertContainsOnlyInstancesOf('AerialShip\\LightSaml\\Model\\Metadata\\EntityDescriptor', $all); $this->assertEquals('ed1', $all[0]->getEntityID()); $this->assertEquals('ed2', $all[1]->getEntityID()); $this->assertEquals('ed3', $all[2]->getEntityID()); $this->assertEquals('ed4', $all[3]->getEntityID()); }