/**
  * Test set- and get- methods for schema types
  */
 function testSchemaType()
 {
     // Create entity
     $place_id = wl_create_post("Entity 1 Text", 'entity-1', "Entity 1 Title", 'publish', 'entity');
     // Type not specified, so it must be a schema.org/Thing
     $type = wl_schema_get_types($place_id);
     $this->assertEquals(1, count($type));
     $this->assertEquals('http://schema.org/Thing', $type[0]);
     // Assign a non supported type
     wl_schema_set_types($place_id, 'Ulabadoola');
     // Verify still a Thing
     $type = wl_schema_get_types($place_id);
     $this->assertEquals(1, count($type));
     $this->assertEquals('http://schema.org/Thing', $type[0]);
     // Assign supported type
     wl_schema_set_types($place_id, 'Place');
     // Verify it is now a Place
     $type = wl_schema_get_types($place_id);
     $this->assertEquals(array('http://schema.org/Place'), $type);
 }
/**
 * Adds default schema type "Thing" as soon as an entity is created.
 */
function wordlift_save_post_add_default_schema_type($entity_id)
{
    $entity = get_post($entity_id);
    $entity_type = wl_schema_get_types($entity_id);
    // Assign type 'Thing' if we are dealing with an entity without type
    if ($entity->post_type == WL_ENTITY_TYPE_NAME && is_null($entity_type)) {
        wl_schema_set_types($entity_id, 'Thing');
    }
}