/** * @test * @group entity */ public function an_entity_type_can_be_cast_to_string() { $spAsString = (string) EntityType::SP(); $idpAsString = (string) EntityType::IdP(); $this->assertEquals(EntityType::TYPE_SP, $spAsString); $this->assertEquals(EntityType::TYPE_IDP, $idpAsString); }
/** * @test * @group entity */ public function an_entity_can_be_cast_to_a_known_format_string() { $entityId = new EntityId('OpenConext'); $entityType = EntityType::SP(); $entity = new Entity($entityId, $entityType); $expected = sprintf('%s (%s)', $entityId, $entityType); $this->assertEquals($expected, (string) $entity); }
/** * @test * @group entity */ public function an_entity_set_can_be_cast_to_a_known_format_string() { $entityOne = new Entity(new EntityId('RUG'), EntityType::SP()); $entityTwo = new Entity(new EntityId('HU'), EntityType::IdP()); $entities = array($entityOne, $entityTwo); $entitySet = new EntitySet($entities); $this->assertEquals(sprintf('EntitySet["%s"]', implode('", "', $entities)), (string) $entitySet); }
public function serialize() { return array('entity_id' => $this->entityId->serialize(), 'entity_type' => $this->entityType->serialize()); }