当前位置: 首页>>代码示例>>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;未经允许,请勿转载。