Пример #1
0
 public function testSchemaWithObjectAddsObject()
 {
     $person = new Schema('Person');
     $person->addProperty('name', 'Name');
     $this->schema->addProperty('person', $person);
     $this->assertContains('"@type": "' . $person->getType() . '"', $this->schema->getJsonLd());
 }
Пример #2
0
 /**
  * @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');
 }
Пример #3
0
 public function testGetSchemaValue()
 {
     $propertyName = 'name';
     $name = 'Author';
     $schema = new Schema('Book');
     $schema->addProperty($propertyName, $name);
     $this->expectOutputString($name);
     $schema->outputProperty($propertyName);
 }