-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from linkwise/feature/website-context
Add WebSite context.
- Loading branch information
Showing
2 changed files
with
54 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
<?php | ||
|
||
namespace JsonLd\ContextTypes; | ||
|
||
class WebSite extends AbstractContext | ||
{ | ||
/** | ||
* Property structure | ||
* | ||
* @var array | ||
*/ | ||
protected $structure = [ | ||
'about' => null, | ||
'headline' => null, | ||
'image' => null, | ||
'name' => null, | ||
'url' => null, | ||
'keywords' => null, | ||
'sameAs' => null, | ||
]; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
<?php | ||
|
||
namespace JsonLd\Test\ContextTypes; | ||
|
||
use JsonLd\Test\TestCase; | ||
|
||
class WebSiteTest extends TestCase | ||
{ | ||
protected $class = \JsonLd\ContextTypes\WebSite::class; | ||
|
||
protected $attributes = [ | ||
'about' => 'The subject matter of the content.', | ||
'headline' => 'Headline of the article.', | ||
'image' => 'https://og.github.com/mark/[email protected]', | ||
'name' => 'The name of the item.', | ||
'url' => 'https://schema.org/WebSite', | ||
'keywords' => 'about,headline,image,name,url', | ||
'sameAs' => 'https://schema.org/sameAs', | ||
]; | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldGetProperties() | ||
{ | ||
$context = $this->make(); | ||
|
||
$this->assertEquals(array_merge([ | ||
'@context' => 'http://schema.org', | ||
'@type' => 'WebSite', | ||
], $this->attributes), $context->getProperties()); | ||
} | ||
} |