You are here

protected function EasyRdfConverterTest::testPropertiesOfType in Schema.org configuration tool (RDF UI) 8

Tests that correct properties are returned for a given type.

File

src/Tests/EasyRdfConverterTest.php, line 56

Class

EasyRdfConverterTest
Tests the Easy Rdf Converter Class & SchemaOrgConverter class.

Namespace

Drupal\rdfui\Tests

Code

protected function testPropertiesOfType() {
  $properties = $this->graph
    ->getTypeProperties("schema:Article");
  $this
    ->assertTrue(in_array("wordCount", $properties), 'Properties of Type(Article) loaded.');
  $this
    ->assertTrue(in_array("author", $properties), 'Properties of parent Type(CreativeWork)loaded.');
  $this
    ->assertTrue(in_array("name", $properties), 'Properties of base Type(Thing) loaded.');
  $this
    ->assertFalse(in_array("birthDate", $properties), 'Properties not in the Type are not loaded.');

  // Test that deprecated properties are not listed.
  $properties = $this->graph
    ->getTypeProperties("schema:Event");
  $this
    ->assertTrue(in_array("attendee", $properties), 'Property "attendee" of Type "Event" is listed.');
  $this
    ->assertFalse(in_array("attendees", $properties), 'Deprecated property "attendees" of Type "Event" is not listed.');
}