本文整理汇总了PHP中CustomFieldData::forgetAll方法的典型用法代码示例。如果您正苦于以下问题:PHP CustomFieldData::forgetAll方法的具体用法?PHP CustomFieldData::forgetAll怎么用?PHP CustomFieldData::forgetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomFieldData
的用法示例。
在下文中一共展示了CustomFieldData::forgetAll方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testGetCustomFieldData
/**
* @depends testApiServerUrl
*/
public function testGetCustomFieldData()
{
$authenticationData = $this->login();
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
//Fill some data
$values = array('Prospect', 'Customer', 'Vendor');
$typeFieldData = CustomFieldData::getByName('AccountTypes');
$typeFieldData->serializedData = serialize($values);
$this->assertTrue($typeFieldData->save());
CustomFieldData::forgetAll();
$customFieldData = CustomFieldData::getByName('AccountTypes');
$compareData = CustomFieldDataUtil::getDataIndexedByDataAndTranslatedLabelsByLanguage($customFieldData, 'en');
$response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/zurmo/customField/api/read/AccountTypes', 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals($compareData, $response['data']);
}
示例2: testAddValuesToCustomFieldData
public function testAddValuesToCustomFieldData()
{
$authenticationData = $this->login();
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
$typeFieldData = CustomFieldData::getByName('AccountTypes');
$compareData = CustomFieldDataUtil::getDataIndexedByDataAndTranslatedLabelsByLanguage($typeFieldData, 'en');
$data = array('values' => array('Unknown', 'None', array('Not Alowed', '22'), 'None'));
$response = $this->createApiCallWithRelativeUrl('addValues/' . $typeFieldData->name, 'PUT', $headers, array('data' => $data));
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$compareData['Unknown'] = 'Unknown';
$compareData['None'] = 'None';
$this->assertEquals($compareData, $response['data']);
// Test get custom field
CustomFieldData::forgetAll();
$response = $this->createApiCallWithRelativeUrl('read/AccountTypes', 'GET', $headers);
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
$this->assertEquals($compareData, $response['data']);
// Test with user that not belong to super administrator group
$notAllowedUser = UserTestHelper::createBasicUser('Steven');
$notAllowedUser->setRight('UsersModule', UsersModule::RIGHT_LOGIN_VIA_WEB_API);
$this->assertTrue($notAllowedUser->save());
// Test with unprivileged user that do not belong to super administrators group
$authenticationData = $this->login('steven', 'steven');
$headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
$data = array('values' => array('Unknown2', 'None2'));
$response = $this->createApiCallWithRelativeUrl('addValues/AccountTypes', 'PUT', $headers, array('data' => $data));
$response = json_decode($response, true);
$this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
$this->assertEquals('You do not have rights to perform this action.', $response['message']);
}