Skip to content

Commit 6df521a

Browse files
author
Aarjan Langereis
committed
Added 'email' to Organization and ContactPoint
1 parent b0955b9 commit 6df521a

File tree

4 files changed

+24
-0
lines changed

4 files changed

+24
-0
lines changed

src/ContextTypes/ContactPoint.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ class ContactPoint extends AbstractContext
1212
protected $structure = [
1313
'telephone' => null,
1414
'contactType' => null,
15+
'email' => null,
1516
];
1617
}

src/ContextTypes/Organization.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ class Organization extends Thing
1313
'address' => PostalAddress::class,
1414
'logo' => ImageObject::class,
1515
'contactPoint' => ContactPoint::class,
16+
'email' => null,
1617
];
1718

1819
/**

tests/ContextTypes/Organization2ContactsTest.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class Organization2ContactsTest extends TestCase
1111
protected $attributes = [
1212
'name' => 'Said Organization',
1313
'url' => 'https://google.com/organization/22',
14+
'email' => 'info@nomail.com',
1415
'address' => [
1516
'streetAddress' => '112 Apple St.',
1617
'addressLocality' => 'Hamden',
@@ -20,10 +21,12 @@ class Organization2ContactsTest extends TestCase
2021
'logo' => 'https://google.com/thumbnail1.jpg',
2122
'contactPoint' => [
2223
['@type' => 'contactPoint',
24+
'email' => 'support@nomail.com',
2325
'telephone' => '18008888888',
2426
'contactType' => 'customer service',
2527
],
2628
['@type' => 'contactPoint',
29+
'email' => 'sales@nomail.com',
2730
'telephone' => '18009999999',
2831
'contactType' => 'sales',
2932
],
@@ -39,11 +42,13 @@ public function shouldHave2ContactsArray()
3942

4043
$this->assertEquals([
4144
'@type' => 'ContactPoint',
45+
'email' => 'support@nomail.com',
4246
'telephone' => '18008888888',
4347
'contactType' => 'customer service',
4448
], $context->getProperty('contactPoint')[0]);
4549
$this->assertEquals([
4650
'@type' => 'ContactPoint',
51+
'email' => 'sales@nomail.com',
4752
'telephone' => '18009999999',
4853
'contactType' => 'sales',
4954
], $context->getProperty('contactPoint')[1]);

tests/ContextTypes/OrganizationTest.php

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ class OrganizationTest extends TestCase
1111
protected $attributes = [
1212
'name' => 'Said Organization',
1313
'url' => 'https://google.com/organization/22',
14+
'email' => 'info@nomail.com',
1415
'address' => [
1516
'streetAddress' => '112 Apple St.',
1617
'addressLocality' => 'Hamden',
@@ -19,11 +20,26 @@ class OrganizationTest extends TestCase
1920
],
2021
'logo' => 'https://google.com/thumbnail1.jpg',
2122
'contactPoint' => [
23+
'email' => 'support@nomail.com',
2224
'telephone' => '18009999999',
2325
'contactType' => 'customer service',
2426
],
2527
];
2628

29+
/**
30+
* @test
31+
*/
32+
public function test_should_have_properties() {
33+
34+
$this->assertPropertyEquals('name', 'Said Organization');
35+
36+
$this->assertPropertyEquals('url', 'https://google.com/organization/22');
37+
38+
$this->assertPropertyEquals('email', 'info@nomail.com');
39+
40+
$this->assertPropertyEquals('logo', 'https://google.com/thumbnail1.jpg');
41+
}
42+
2743
/**
2844
* @test
2945
*/
@@ -33,6 +49,7 @@ public function shouldHaveContactPointObject()
3349

3450
$this->assertEquals([
3551
'@type' => 'ContactPoint',
52+
'email' => 'support@nomail.com',
3653
'telephone' => '18009999999',
3754
'contactType' => 'customer service',
3855
], $context->getProperty('contactPoint'));

0 commit comments

Comments
 (0)