Skip to content
This repository was archived by the owner on Oct 24, 2023. It is now read-only.

Commit 1233835

Browse files
author
Jens Schulze
committed
fix(CustomerDraft): correct type mapping for customer draft dateOfBirth
1 parent 26c14a1 commit 1233835

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

src/Model/Customer/CustomerDraft.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
use Commercetools\Core\Model\CustomerGroup\CustomerGroupReference;
1414
use Commercetools\Core\Model\Common\AddressCollection;
1515
use Commercetools\Core\Model\CustomField\CustomFieldObjectDraft;
16+
use Commercetools\Core\Model\Common\DateDecorator;
1617

1718
/**
1819
* @package Commercetools\Core\Model\Customer
@@ -35,7 +36,7 @@
3536
* @method CustomerDraft setPassword(string $password = null)
3637
* @method CustomerDraft setAnonymousCartId(string $anonymousCartId = null)
3738
* @method CustomerDraft setExternalId(string $externalId = null)
38-
* @method DateTimeDecorator getDateOfBirth()
39+
* @method DateDecorator getDateOfBirth()
3940
* @method CustomerDraft setDateOfBirth(\DateTime $dateOfBirth = null)
4041
* @method string getCompanyName()
4142
* @method CustomerDraft setCompanyName(string $companyName = null)

tests/integration/Customer/CustomerUpdateRequestTest.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -491,6 +491,7 @@ public function testCompanyName()
491491
public function testDateOfBirth()
492492
{
493493
$draft = $this->getDraft('date-of-birth');
494+
$draft->setDateOfBirth(new \DateTime('yesterday'));
494495
$customer = $this->createCustomer($draft);
495496

496497
$timezone = date_default_timezone_get();

tests/unit/Model/Customer/CustomerDraftTest.php

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,4 +21,12 @@ public function testFromArray()
2121
)
2222
);
2323
}
24+
25+
public function testDateOfBirth()
26+
{
27+
$draft = CustomerDraft::of();
28+
$draft->setDateOfBirth(new \DateTime('2015-10-15 10:00'));
29+
$this->assertJsonStringEqualsJsonString('{"dateOfBirth": "2015-10-15"}', json_encode($draft));
30+
31+
}
2432
}

0 commit comments

Comments
 (0)