-
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 #39 from boly38/feature/website
improve WebSite context
- Loading branch information
Showing
3 changed files
with
96 additions
and
5 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
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
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 |
---|---|---|
|
@@ -10,11 +10,24 @@ class WebSiteTest extends TestCase | |
|
||
protected $attributes = [ | ||
'about' => 'The subject matter of the content.', | ||
'headline' => 'Headline of the article.', | ||
'headline' => 'Headline of the website.', | ||
'image' => 'https://og.github.com/mark/[email protected]', | ||
'name' => 'The name of the item.', | ||
'url' => 'https://schema.org/WebSite', | ||
'publisher' => [ | ||
'name' => 'Google', | ||
'logo' => [ | ||
'@type' => 'ImageObject', | ||
'url' => 'https://google.com/logo.jpg', | ||
'width' => 600, | ||
'height' => 60, | ||
] | ||
], | ||
'keywords' => 'about,headline,image,name,url', | ||
'inLanguage' => 'en', | ||
'dateCreated' => '2013-10-04T00:00', | ||
'dateModified' => '2013-10-04T00:00', | ||
'datePublished' => '2013-10-04T00:00', | ||
'sameAs' => 'https://schema.org/sameAs', | ||
]; | ||
|
||
|
@@ -25,9 +38,60 @@ public function shouldGetProperties() | |
{ | ||
$context = $this->make(); | ||
|
||
$this->assertEquals(array_merge([ | ||
'@context' => 'http://schema.org', | ||
'@type' => 'WebSite', | ||
], $this->attributes), $context->getProperties()); | ||
$attributesPlus = $this->attributes; | ||
$attributesPlus['@context'] = 'http://schema.org'; | ||
$attributesPlus["@type"] = 'WebSite'; | ||
$attributesPlus["publisher"]["@type"] = 'Organization'; | ||
|
||
$this->assertEquals($context->getProperties(), $attributesPlus); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldHaveHeadline() | ||
{ | ||
$context = $this->make(); | ||
|
||
$this->assertEquals('Headline of the website.', $context->getProperty('headline')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldHavePublisherObject() | ||
{ | ||
$context = $this->make(); | ||
|
||
$this->assertEquals([ | ||
'@type' => 'Organization', | ||
'name' => 'Google', | ||
'logo' => [ | ||
'@type' => 'ImageObject', | ||
'url' => 'https://google.com/logo.jpg', | ||
'height' => 60, | ||
'width' => 600, | ||
], | ||
], $context->getProperty('publisher')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldHaveKeywords() | ||
{ | ||
$context = $this->make(); | ||
|
||
$this->assertEquals('about,headline,image,name,url', $context->getProperty('keywords')); | ||
} | ||
|
||
/** | ||
* @test | ||
*/ | ||
public function shouldHaveInLanguage() | ||
{ | ||
$context = $this->make(); | ||
|
||
$this->assertEquals('en', $context->getProperty('inLanguage')); | ||
} | ||
} |