当前位置: 首页>>代码示例>>PHP>>正文


PHP AccountTestHelper::createAccountByNameTypeAndIndustryForOwner方法代码示例

本文整理汇总了PHP中AccountTestHelper::createAccountByNameTypeAndIndustryForOwner方法的典型用法代码示例。如果您正苦于以下问题:PHP AccountTestHelper::createAccountByNameTypeAndIndustryForOwner方法的具体用法?PHP AccountTestHelper::createAccountByNameTypeAndIndustryForOwner怎么用?PHP AccountTestHelper::createAccountByNameTypeAndIndustryForOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在AccountTestHelper的用法示例。


在下文中一共展示了AccountTestHelper::createAccountByNameTypeAndIndustryForOwner方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: testBasicSearchOpportunities

 /**
  * @depends testListOpportunities
  */
 public function testBasicSearchOpportunities()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     Opportunity::deleteAll();
     $anotherUser = User::getByUsername('steven');
     $authenticationData = $this->login();
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     $firstAccount = AccountTestHelper::createAccountByNameTypeAndIndustryForOwner('First Account', 'Customer', 'Automotive', $super);
     $secondAccount = AccountTestHelper::createAccountByNameTypeAndIndustryForOwner('Second Account', 'Customer', 'Automotive', $super);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('First Opportunity', $super, $firstAccount);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('Second Opportunity', $super, $firstAccount);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('Third Opportunity', $super, $firstAccount);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('Forth Opportunity', $anotherUser, $firstAccount);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('Fifth Opportunity', $super, $secondAccount);
     $searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('name' => ''), 'sort' => 'name');
     $searchParamsQuery = http_build_query($searchParams);
     $response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(3, count($response['data']['items']));
     $this->assertEquals(5, $response['data']['totalCount']);
     $this->assertEquals(1, $response['data']['currentPage']);
     $this->assertEquals('Fifth Opportunity', $response['data']['items'][0]['name']);
     $this->assertEquals('First Opportunity', $response['data']['items'][1]['name']);
     $this->assertEquals('Forth Opportunity', $response['data']['items'][2]['name']);
     // Second page
     $searchParams['pagination']['page'] = 2;
     $searchParamsQuery = http_build_query($searchParams);
     $response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(2, count($response['data']['items']));
     $this->assertEquals(5, $response['data']['totalCount']);
     $this->assertEquals(2, $response['data']['currentPage']);
     $this->assertEquals('Second Opportunity', $response['data']['items'][0]['name']);
     $this->assertEquals('Third Opportunity', $response['data']['items'][1]['name']);
     // Search by name
     $searchParams['pagination']['page'] = 1;
     $searchParams['search']['name'] = 'First Opportunity';
     $searchParamsQuery = http_build_query($searchParams);
     $response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(1, count($response['data']['items']));
     $this->assertEquals(1, $response['data']['totalCount']);
     $this->assertEquals(1, $response['data']['currentPage']);
     $this->assertEquals('First Opportunity', $response['data']['items'][0]['name']);
     // No results
     $searchParams['pagination']['page'] = 1;
     $searchParams['search']['name'] = 'First Opportunity 2';
     $searchParamsQuery = http_build_query($searchParams);
     $response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(0, $response['data']['totalCount']);
     $this->assertFalse(isset($response['data']['items']));
     // Search by name desc.
     $searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('name' => ''), 'sort' => 'name.desc');
     $searchParamsQuery = http_build_query($searchParams);
     $response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(3, count($response['data']['items']));
     $this->assertEquals(5, $response['data']['totalCount']);
     $this->assertEquals(1, $response['data']['currentPage']);
     $this->assertEquals('Third Opportunity', $response['data']['items'][0]['name']);
     $this->assertEquals('Second Opportunity', $response['data']['items'][1]['name']);
     $this->assertEquals('Forth Opportunity', $response['data']['items'][2]['name']);
     // Second page
     $searchParams['pagination']['page'] = 2;
     $searchParamsQuery = http_build_query($searchParams);
     $response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(2, count($response['data']['items']));
     $this->assertEquals(5, $response['data']['totalCount']);
     $this->assertEquals(2, $response['data']['currentPage']);
     $this->assertEquals('First Opportunity', $response['data']['items'][0]['name']);
     $this->assertEquals('Fifth Opportunity', $response['data']['items'][1]['name']);
     // Search by custom fields, order by name desc
     $searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('owner' => array('id' => $anotherUser->id)), 'sort' => 'name.desc');
     $searchParamsQuery = http_build_query($searchParams);
     $response = $this->createApiCallWithRelativeUrl('list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(1, count($response['data']['items']));
     $this->assertEquals(1, $response['data']['totalCount']);
     $this->assertEquals(1, $response['data']['currentPage']);
     $this->assertEquals('Forth Opportunity', $response['data']['items'][0]['name']);
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:94,代码来源:ApiRestOpportunityTest.php

示例2: testSearchMeetings

 /**
  * @depends testUnprivilegedUserViewUpdateDeleteMeetings
  */
 public function testSearchMeetings()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $anotherUser = User::getByUsername('steven');
     $authenticationData = $this->login();
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     $firstAccount = AccountTestHelper::createAccountByNameTypeAndIndustryForOwner('First Account', 'Customer', 'Automotive', $super);
     $secondAccount = AccountTestHelper::createAccountByNameTypeAndIndustryForOwner('Second Account', 'Customer', 'Automotive', $super);
     MeetingTestHelper::createMeetingWithOwnerAndRelatedAccount('First Meeting', $super, $firstAccount);
     MeetingTestHelper::createMeetingWithOwnerAndRelatedAccount('Second Meeting', $super, $firstAccount);
     MeetingTestHelper::createMeetingWithOwnerAndRelatedAccount('Third Meeting', $super, $secondAccount);
     MeetingTestHelper::createMeetingWithOwnerAndRelatedAccount('Forth Meeting', $anotherUser, $secondAccount);
     MeetingTestHelper::createMeetingWithOwnerAndRelatedAccount('Fifth Meeting', $super, $firstAccount);
     $searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('name' => ''), 'sort' => 'name');
     $searchParamsQuery = http_build_query($searchParams);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(3, count($response['data']['items']));
     $this->assertEquals(5, $response['data']['totalCount']);
     $this->assertEquals(1, $response['data']['currentPage']);
     $this->assertEquals('Fifth Meeting', $response['data']['items'][0]['name']);
     $this->assertEquals('First Meeting', $response['data']['items'][1]['name']);
     $this->assertEquals('Forth Meeting', $response['data']['items'][2]['name']);
     // Second page
     $searchParams['pagination']['page'] = 2;
     $searchParamsQuery = http_build_query($searchParams);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(2, count($response['data']['items']));
     $this->assertEquals(5, $response['data']['totalCount']);
     $this->assertEquals(2, $response['data']['currentPage']);
     $this->assertEquals('Second Meeting', $response['data']['items'][0]['name']);
     $this->assertEquals('Third Meeting', $response['data']['items'][1]['name']);
     // Search by name
     $searchParams['pagination']['page'] = 1;
     $searchParams['search']['name'] = 'First Meeting';
     $searchParamsQuery = http_build_query($searchParams);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(1, count($response['data']['items']));
     $this->assertEquals(1, $response['data']['totalCount']);
     $this->assertEquals(1, $response['data']['currentPage']);
     $this->assertEquals('First Meeting', $response['data']['items'][0]['name']);
     // No results
     $searchParams['pagination']['page'] = 1;
     $searchParams['search']['name'] = 'First Meeting 2';
     $searchParamsQuery = http_build_query($searchParams);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(0, $response['data']['totalCount']);
     $this->assertFalse(isset($response['data']['items']));
     // Search by name desc.
     $searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('name' => ''), 'sort' => 'name.desc');
     $searchParamsQuery = http_build_query($searchParams);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(3, count($response['data']['items']));
     $this->assertEquals(5, $response['data']['totalCount']);
     $this->assertEquals(1, $response['data']['currentPage']);
     $this->assertEquals('Third Meeting', $response['data']['items'][0]['name']);
     $this->assertEquals('Second Meeting', $response['data']['items'][1]['name']);
     $this->assertEquals('Forth Meeting', $response['data']['items'][2]['name']);
     // Second page
     $searchParams['pagination']['page'] = 2;
     $searchParamsQuery = http_build_query($searchParams);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(2, count($response['data']['items']));
     $this->assertEquals(5, $response['data']['totalCount']);
     $this->assertEquals(2, $response['data']['currentPage']);
     $this->assertEquals('First Meeting', $response['data']['items'][0]['name']);
     $this->assertEquals('Fifth Meeting', $response['data']['items'][1]['name']);
     // Search by custom fields, order by name desc
     $searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('owner' => array('id' => $super->id)), 'sort' => 'name.desc');
     $searchParamsQuery = http_build_query($searchParams);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
     $this->assertEquals(4, $response['data']['totalCount']);
     $this->assertEquals(3, count($response['data']['items']));
     $this->assertEquals(1, $response['data']['currentPage']);
     $this->assertEquals('Third Meeting', $response['data']['items'][0]['name']);
     $this->assertEquals('Second Meeting', $response['data']['items'][1]['name']);
     $this->assertEquals('First Meeting', $response['data']['items'][2]['name']);
     // Search by account, order by name desc
     $searchParams = array('pagination' => array('page' => 1, 'pageSize' => 3), 'search' => array('activityItems' => array('id' => $firstAccount->getClassId('Item'))), 'sort' => 'name.desc');
     $searchParamsQuery = http_build_query($searchParams);
     $response = ApiRestTestHelper::createApiCall($this->serverUrl . '/test.php/meetings/meeting/api/list/filter/' . $searchParamsQuery, 'GET', $headers);
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_SUCCESS, $response['status']);
//.........这里部分代码省略.........
开发者ID:youprofit,项目名称:Zurmo,代码行数:101,代码来源:ApiRestMeetingTest.php

示例3: testEditAccountWIthIncorrectDataType

 public function testEditAccountWIthIncorrectDataType()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $authenticationData = $this->login();
     $headers = array('Accept: application/json', 'ZURMO_SESSION_ID: ' . $authenticationData['sessionId'], 'ZURMO_TOKEN: ' . $authenticationData['token'], 'ZURMO_API_REQUEST_TYPE: REST');
     AccountTestHelper::createAccountByNameTypeAndIndustryForOwner('Newest Account', 'Customer', 'Automotive', $super);
     // Provide data with wrong type.
     $data['name'] = "AAA";
     $data['employees'] = "SS";
     $response = $this->createApiCallWithRelativeUrl('create/', 'POST', $headers, array('data' => $data));
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
     $this->assertEquals(1, count($response['errors']));
     $accounts = Account::getByName('Newest Account');
     $this->assertEquals(1, count($accounts));
     $id = $accounts[0]->id;
     $data = array();
     $data['employees'] = 'DD';
     $response = $this->createApiCallWithRelativeUrl('update/' . $id, 'PUT', $headers, array('data' => $data));
     $response = json_decode($response, true);
     $this->assertEquals(ApiResponse::STATUS_FAILURE, $response['status']);
     $this->assertEquals(1, count($response['errors']));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:24,代码来源:ApiRestAccountTest.php


注:本文中的AccountTestHelper::createAccountByNameTypeAndIndustryForOwner方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。