Skip to content

Commit d2a292c

Browse files
author
Daniel Fariña Hernández
committed
test
1 parent a2bba83 commit d2a292c

File tree

1 file changed

+49
-0
lines changed

1 file changed

+49
-0
lines changed

tests/unit/AutopilotContactCest.php

+49
Original file line numberDiff line numberDiff line change
@@ -163,6 +163,55 @@ public function testContactToRequest(UnitTester $I)
163163
$I->assertEquals($expected['contact'], $contact->toRequest($prependKey = false));
164164
}
165165

166+
public function testContactFieldsCanBeCleared(UnitTester $I)
167+
{
168+
$I->wantTo('clear contact fields');
169+
170+
$values = [
171+
'FirstName' => null,
172+
'LastName' => null,
173+
'custom_fields' => [
174+
[
175+
'kind' => 'Age',
176+
'value' => null,
177+
'fieldType' => 'integer',
178+
],
179+
[
180+
'kind' => 'Birthday',
181+
'value' => null,
182+
'fieldType' => 'date',
183+
],
184+
[
185+
'kind' => 'Category',
186+
'value' => null,
187+
'fieldType' => 'string',
188+
],
189+
[
190+
'kind' => 'Completed Status',
191+
'value' => null,
192+
'fieldType' => 'float',
193+
],
194+
],
195+
];
196+
197+
$contact = new AutopilotContact($values);
198+
199+
$expected = [
200+
'contact' => [
201+
'FirstName' => null,
202+
'LastName' => null,
203+
'custom' => [
204+
'integer--Age' => null,
205+
'date--Birthday' => null,
206+
'string--Category' => null,
207+
'float--Completed--Status' => null,
208+
],
209+
],
210+
];
211+
212+
$I->assertEquals($expected, $contact->toRequest());
213+
}
214+
166215
public function testContactMagicGettersAndSetters(UnitTester $I)
167216
{
168217
$I->wantTo('set and get values using magic methods');

0 commit comments

Comments
 (0)