File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -99,6 +99,29 @@ public function testUpsert(): void
9999 $ this ->assertEquals ('test ' , $ endpoint ->foobar_c );
100100 $ this ->assertEquals ('Prospect ' , $ endpoint ['account_type ' ]);
101101 }
102+ public function testUpsertWithSetField (): void
103+ {
104+ $ this ->client ->mockResponses ->append (new Response ('201 ' ));
105+ $ endpoint = new Integrate ();
106+ $ endpoint ->setClient ($ this ->client );
107+ $ endpoint ->setModule ('Accounts ' );
108+ $ endpoint ['name ' ] = 'Test Account ' ;
109+ $ endpoint ['sync_key ' ] = 'test ' ;
110+ $ Reflection = new \ReflectionClass ($ endpoint ::class);
111+ $ configurePayload = $ Reflection ->getMethod ('configurePayload ' );
112+ $ configurePayload ->setAccessible (true );
113+ $ payload = $ configurePayload ->invoke ($ endpoint )->toArray ();
114+ $ this ->assertArrayNotHasKey ('fields ' , $ payload );
115+
116+ $ this ->client ->mockResponses ->append (new Response ('201 ' ));
117+ $ endpoint ->setFields (['foobar_c ' , 'account_type ' ]);
118+ $ endpoint ->upsert ();
119+
120+ $ payload = $ configurePayload ->invoke ($ endpoint )->toArray ();
121+ $ this ->assertArrayHasKey ('fields ' , $ payload );
122+ $ fields = $ payload ['fields ' ];
123+ $ this ->assertEquals ("foobar_c,account_type " , $ fields );
124+ }
102125
103126 /**
104127 * @covers ::getSyncKey
You can’t perform that action at this time.
0 commit comments