Slide 63
Slide 63 text
/**
* Tests that objects works as expected.
*/
public function testObject(): void {
$author = Author::createFromArray($this->getSampleId(), $this->getSampleValues());
$this->assertEquals($this->getSampleId(), $author->getId());
$this->assertEquals($this->getSampleValues()['name']['given'], $author->getNameGiven());
$this->assertEquals($this->getSampleValues()['name']['family'], $author->getNameFamily());
$this->assertEquals($this->getSampleValues()['country'], $author->getCountry());
$this->assertEquals($this->getSampleValues()['org']['name'], $author->getOrgName());
$this->assertEquals($this->getSampleValues()['org']['unit'], $author->getOrgUnit());
$this->assertEquals($this->getSampleValues()['homepage'], $author->getHomepage());
$this->assertEquals($this->getSampleValues()['description'], $author->getDescription());
$this->assertEquals($this->getSampleValues()['image'], $author->getImage());
$this->assertEquals($this->getSampleValues()['identification'], $author->getIdentification());
$this->assertEquals($this->getSampleValues()['identification']['email'],
$author->getIdentification('email'));
$this->assertEquals([], $author->getIdentification('not exist'));
$this->assertEquals($author->checksum(), $author->checksum());
}
Drupal - PHP