當前位置: 首頁>>代碼示例>>PHP>>正文


PHP CustomFieldData::forgetAll方法代碼示例

本文整理匯總了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']);
 }
開發者ID:youprofit,項目名稱:Zurmo,代碼行數:20,代碼來源:ApiRestCustomFieldTest.php

示例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']);
 }
開發者ID:RamaKavanan,項目名稱:InitialVersion,代碼行數:32,代碼來源:ApiRestCustomFieldTest.php


注:本文中的CustomFieldData::forgetAll方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。