public function testSchemaWithObjectAddsObject() { $person = new Schema('Person'); $person->addProperty('name', 'Name'); $this->schema->addProperty('person', $person); $this->assertContains('"@type": "' . $person->getType() . '"', $this->schema->getJsonLd()); }
/** * @expectedException \RuntimeException * @expectedExceptionMessage \NYPL\SchemaBuilder\Outputter\MicrodataOutputter::EXCEPTION_SUB_PROPERTY_OUTPUTTED_BEFORE_OBJECT */ public function testParentPropertyThrowsExceptionIfNotOutputter() { $itemProperty = 'offers'; $parentItemProperty = 'offeredBy'; $offer = new Schema('Offer'); $offer->addProperty($parentItemProperty, 'NYPL'); $this->schema->addProperty($itemProperty, $offer); $this->schema->getMicrodata(); $this->schema->getProperty('offers')->getMicrodata('offeredBy'); }
public function testGetSchemaValue() { $propertyName = 'name'; $name = 'Author'; $schema = new Schema('Book'); $schema->addProperty($propertyName, $name); $this->expectOutputString($name); $schema->outputProperty($propertyName); }