public function testKeepEmptyRemarksWhenSpecified() { $this->passholder->moreInfo = ''; $this->passholder->toPostDataKeepEmptyMoreInfo(); $postData = $this->passholder->toPostData(); $this->assertArrayNotHasKey('postDataEmptyPropertiesToKeep', $postData); $this->assertArrayHasKey('moreInfo', $postData); $this->assertEquals($this->passholder->moreInfo, $postData['moreInfo']); $this->passholder->toPostDataKeepEmptyMoreInfo(FALSE); $postData = $this->passholder->toPostData(); $this->assertArrayNotHasKey('moreInfo', $postData); }
/** * Update a passholder. * * @param CultureFeed_Uitpas_Passholder $passholder The passholder to update. * The passholder is identified by ID. Only fields that are set will be updated. * @param null $consumer_key_counter * @return \CultureFeed_Uitpas_Response * @throws \CultureFeed_ParseException */ public function updatePassholder(CultureFeed_Uitpas_Passholder $passholder, $consumer_key_counter = NULL) { $data = $passholder->toPostData(); if ($consumer_key_counter) { $data['balieConsumerKey'] = $consumer_key_counter; } $result = $this->oauth_client->authenticatedPostAsXml('uitpas/passholder/' . $passholder->uitpasNumber, $data); try { $xml = new CultureFeed_SimpleXMLElement($result); } catch (Exception $e) { throw new CultureFeed_ParseException($result); } $response = CultureFeed_Uitpas_Response::createFromXML($xml->xpath('/response', false)); return $response; }
public function testUpdate() { $balieConsumerKey = 'b95d1bcf-533d-45ac-afcd-e015cfe86c84'; $passholder = new CultureFeed_Uitpas_Passholder(); $passholder->uitpasNumber = '1000001500601'; $passholder->name = 'Tester'; $oauth_client_stub = $this->getMock('CultureFeed_OAuthClient'); $path = 'uitpas/passholder/' . $passholder->uitpasNumber; $data = $passholder->toPostData(); $data['balieConsumerKey'] = $balieConsumerKey; $passholder_xml = file_get_contents(dirname(__FILE__) . '/data/passholder.update.succeeded.xml'); $oauth_client_stub->expects($this->any())->method('authenticatedPostAsXml')->with($path, $data)->willReturn($passholder_xml); $cf = new CultureFeed($oauth_client_stub); $cf->uitpas()->updatePassholder($passholder, $balieConsumerKey); }