Skip to content

Added 'email' to Organization and ContactPoint #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ContextTypes/ContactPoint.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,6 @@ class ContactPoint extends AbstractContext
protected $structure = [
'telephone' => null,
'contactType' => null,
'email' => null,
];
}
1 change: 1 addition & 0 deletions src/ContextTypes/Organization.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ class Organization extends Thing
'address' => PostalAddress::class,
'logo' => ImageObject::class,
'contactPoint' => ContactPoint::class,
'email' => null,
];

/**
Expand Down
5 changes: 5 additions & 0 deletions tests/ContextTypes/Organization2ContactsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class Organization2ContactsTest extends TestCase
protected $attributes = [
'name' => 'Said Organization',
'url' => 'https://google.com/organization/22',
'email' => 'info@nomail.com',
'address' => [
'streetAddress' => '112 Apple St.',
'addressLocality' => 'Hamden',
Expand All @@ -20,10 +21,12 @@ class Organization2ContactsTest extends TestCase
'logo' => 'https://google.com/thumbnail1.jpg',
'contactPoint' => [
['@type' => 'contactPoint',
'email' => 'support@nomail.com',
'telephone' => '18008888888',
'contactType' => 'customer service',
],
['@type' => 'contactPoint',
'email' => 'sales@nomail.com',
'telephone' => '18009999999',
'contactType' => 'sales',
],
Expand All @@ -39,11 +42,13 @@ public function shouldHave2ContactsArray()

$this->assertEquals([
'@type' => 'ContactPoint',
'email' => 'support@nomail.com',
'telephone' => '18008888888',
'contactType' => 'customer service',
], $context->getProperty('contactPoint')[0]);
$this->assertEquals([
'@type' => 'ContactPoint',
'email' => 'sales@nomail.com',
'telephone' => '18009999999',
'contactType' => 'sales',
], $context->getProperty('contactPoint')[1]);
Expand Down
17 changes: 17 additions & 0 deletions tests/ContextTypes/OrganizationTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ class OrganizationTest extends TestCase
protected $attributes = [
'name' => 'Said Organization',
'url' => 'https://google.com/organization/22',
'email' => 'info@nomail.com',
'address' => [
'streetAddress' => '112 Apple St.',
'addressLocality' => 'Hamden',
Expand All @@ -19,11 +20,26 @@ class OrganizationTest extends TestCase
],
'logo' => 'https://google.com/thumbnail1.jpg',
'contactPoint' => [
'email' => 'support@nomail.com',
'telephone' => '18009999999',
'contactType' => 'customer service',
],
];

/**
* @test
*/
public function test_should_have_properties() {

$this->assertPropertyEquals('name', 'Said Organization');

$this->assertPropertyEquals('url', 'https://google.com/organization/22');

$this->assertPropertyEquals('email', 'info@nomail.com');

$this->assertPropertyEquals('logo', 'https://google.com/thumbnail1.jpg');
}

/**
* @test
*/
Expand All @@ -33,6 +49,7 @@ public function shouldHaveContactPointObject()

$this->assertEquals([
'@type' => 'ContactPoint',
'email' => 'support@nomail.com',
'telephone' => '18009999999',
'contactType' => 'customer service',
], $context->getProperty('contactPoint'));
Expand Down