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


PHP Opportunity::getAll方法代码示例

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


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

示例1: testMassDeletePagesProperlyAndRemovesAllSelected

 /**
  *Test Bug with mass delete and multiple pages when using select all
  */
 public function testMassDeletePagesProperlyAndRemovesAllSelected()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //MassDelete for selected Record Count
     $Opportunities = Opportunity::getAll();
     $this->assertEquals(8, count($Opportunities));
     $pageSize = Yii::app()->pagination->getForCurrentUserByType('massDeleteProgressPageSize');
     $this->assertEquals(5, $pageSize);
     //save Model MassDelete for entire search result
     $this->setGetArray(array('selectAll' => '1', 'Opportunity_page' => 1));
     $this->setPostArray(array('selectedRecordCount' => 8));
     //Run Mass Delete using progress save for page1.
     $this->runControllerWithExitExceptionAndGetContent('opportunities/default/massDelete');
     //check for previous mass delete progress
     $Opportunities = Opportunity::getAll();
     $this->assertEquals(3, count($Opportunities));
     $this->setGetArray(array('selectAll' => '1', 'Opportunity_page' => 2));
     $this->setPostArray(array('selectedRecordCount' => 8));
     //Run Mass Delete using progress save for page2.
     $pageSize = Yii::app()->pagination->getForCurrentUserByType('massDeleteProgressPageSize');
     $this->assertEquals(5, $pageSize);
     $this->runControllerWithNoExceptionsAndGetContent('opportunities/default/massDeleteProgress');
     //calculating lead's count
     $Opportunities = Opportunity::getAll();
     $this->assertEquals(0, count($Opportunities));
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:29,代码来源:OpportunitiesSuperUserWalkthroughTest.php

示例2: testGetAllWhenThereAreNone

 public function testGetAllWhenThereAreNone()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $opportunities = Opportunity::getAll();
     $this->assertEquals(0, count($opportunities));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:6,代码来源:OpportunityTest.php

示例3: testImportWithRateAndCurrencyCodeSpecified

 /**
  * There is a special way you can import rateToBase and currencyCode for an amount attribute.
  * if the column data is formatted like: $54.67__1.2__USD  then it will split the column and properly
  * handle rate and currency code.  Eventually this will be exposed in the user interface
  */
 public function testImportWithRateAndCurrencyCodeSpecified()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $account = AccountTestHelper::createAccountByNameForOwner('Account', Yii::app()->user->userModel);
     $accountId = $account->id;
     $opportunities = Opportunity::getAll();
     $this->assertEquals(0, count($opportunities));
     $import = new Import();
     $serializedData['importRulesType'] = 'Opportunities';
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('importTestIncludingRateAndCurrencyCode.csv', $import->getTempTableName(), true, Yii::getPathOfAlias('application.modules.opportunities.tests.unit.files'));
     //update the ids of the account column to match the parent account.
     ZurmoRedBean::exec("update " . $import->getTempTableName() . " set column_3 = " . $account->id . " where id != 1 limit 4");
     $this->assertEquals(4, ImportDatabaseUtil::getCount($import->getTempTableName()));
     // includes header rows.
     $currency = Currency::getByCode(Yii::app()->currencyHelper->getBaseCode());
     $mappingData = array('column_0' => ImportMappingUtil::makeStringColumnMappingData('name'), 'column_1' => ImportMappingUtil::makeDateColumnMappingData('closeDate'), 'column_2' => ImportMappingUtil::makeIntegerColumnMappingData('description'), 'column_3' => ImportMappingUtil::makeHasOneColumnMappingData('account'), 'column_4' => ImportMappingUtil::makeDropDownColumnMappingData('stage'), 'column_5' => ImportMappingUtil::makeDropDownColumnMappingData('source'), 'column_6' => ImportMappingUtil::makeCurrencyColumnMappingData('amount', $currency));
     $importRules = ImportRulesUtil::makeImportRulesByType('Opportunities');
     $page = 0;
     $config = array('pagination' => array('pageSize' => 50));
     //This way all rows are processed.
     $dataProvider = new ImportDataProvider($import->getTempTableName(), true, $config);
     $dataProvider->getPagination()->setCurrentPage($page);
     $importResultsUtil = new ImportResultsUtil($import);
     $messageLogger = new ImportMessageLogger();
     ImportUtil::importByDataProvider($dataProvider, $importRules, $mappingData, $importResultsUtil, new ExplicitReadWriteModelPermissions(), $messageLogger);
     $importResultsUtil->processStatusAndMessagesForEachRow();
     //Confirm that 3 models where created.
     $opportunities = Opportunity::getAll();
     $this->assertEquals(3, count($opportunities));
     $opportunities = Opportunity::getByName('opp1');
     $this->assertEquals(1, count($opportunities[0]));
     $this->assertEquals('opp1', $opportunities[0]->name);
     $this->assertEquals('1980-06-03', $opportunities[0]->closeDate);
     $this->assertEquals(10, $opportunities[0]->probability);
     $this->assertEquals('desc1', $opportunities[0]->description);
     $this->assertTrue($opportunities[0]->account->isSame($account));
     $this->assertEquals('Prospecting', $opportunities[0]->stage->value);
     $this->assertEquals('Self-Generated', $opportunities[0]->source->value);
     $this->assertEquals(500, $opportunities[0]->amount->value);
     $this->assertEquals(1, $opportunities[0]->amount->rateToBase);
     $this->assertEquals('USD', $opportunities[0]->amount->currency->code);
     $opportunities = Opportunity::getByName('opp2');
     $this->assertEquals(1, count($opportunities[0]));
     $this->assertEquals('opp2', $opportunities[0]->name);
     $this->assertEquals('1980-06-04', $opportunities[0]->closeDate);
     $this->assertEquals(25, $opportunities[0]->probability);
     $this->assertEquals('desc2', $opportunities[0]->description);
     $this->assertTrue($opportunities[0]->account->isSame($account));
     $this->assertEquals('Qualification', $opportunities[0]->stage->value);
     $this->assertEquals('Inbound Call', $opportunities[0]->source->value);
     $this->assertEquals(501, $opportunities[0]->amount->value);
     // $this->assertEquals(2.7,                       $opportunities[0]->amount->rateToBase);
     $this->assertEquals('GBP', $opportunities[0]->amount->currency->code);
     $opportunities = Opportunity::getByName('opp3');
     $this->assertEquals(1, count($opportunities[0]));
     $this->assertEquals('opp3', $opportunities[0]->name);
     $this->assertEquals('1980-06-05', $opportunities[0]->closeDate);
     $this->assertEquals(50, $opportunities[0]->probability);
     $this->assertEquals('desc3', $opportunities[0]->description);
     $this->assertTrue($opportunities[0]->account->isSame($account));
     $this->assertEquals('Negotiating', $opportunities[0]->stage->value);
     $this->assertEquals('Tradeshow', $opportunities[0]->source->value);
     $this->assertEquals(502, $opportunities[0]->amount->value);
     // $this->assertEquals(3.2,                       $opportunities[0]->amount->rateToBase);
     $this->assertEquals('EUR', $opportunities[0]->amount->currency->code);
     //Confirm 10 rows were processed as 'created'.
     $this->assertEquals(3, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::CREATED));
     //Confirm that 0 rows were processed as 'updated'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::UPDATED));
     //Confirm 2 rows were processed as 'errors'.
     $this->assertEquals(0, ImportDatabaseUtil::getCount($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR));
     $beansWithErrors = ImportDatabaseUtil::getSubset($import->getTempTableName(), "status = " . ImportRowDataResultsUtil::ERROR);
     $this->assertEquals(0, count($beansWithErrors));
     //test the account has 3 opportunities
     $account->forget();
     $account = Account::getById($accountId);
     $this->assertEquals(3, $account->opportunities->count());
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:86,代码来源:OpportunityImportTest.php

示例4: testAsynchronousDownloadDefaultControllerActions

 /**
  * Walkthrough test for synchronous download
  */
 public function testAsynchronousDownloadDefaultControllerActions()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
     $notificationsBeforeCount = count(Notification::getAll());
     $notificationMessagesBeforeCount = count(NotificationMessage::getAll());
     $opportunities = Opportunity::getAll();
     if (count($opportunities)) {
         foreach ($opportunities as $opportunity) {
             $opportunity->delete();
         }
     }
     $opportunities = array();
     for ($i = 0; $i <= ExportModule::$asynchronousThreshold + 1; $i++) {
         $opportunities[] = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('opportunity' . $i, $super, $account);
     }
     $this->setGetArray(array('Opportunity_page' => '1', 'export' => '', 'ajax' => '', 'selectAll' => '1', 'selectedIds' => ''));
     $this->runControllerWithRedirectExceptionAndGetUrl('opportunities/default/export');
     // Start background job
     $job = new ExportJob();
     $this->assertTrue($job->run());
     $exportItems = ExportItem::getAll();
     $this->assertEquals(1, count($exportItems));
     $fileModel = $exportItems[0]->exportFileModel;
     $this->assertEquals(1, $exportItems[0]->isCompleted);
     $this->assertEquals('csv', $exportItems[0]->exportFileType);
     $this->assertEquals('opportunities', $exportItems[0]->exportFileName);
     $this->assertTrue($fileModel instanceof ExportFileModel);
     $this->assertEquals($notificationsBeforeCount + 1, count(Notification::getAll()));
     $this->assertEquals($notificationMessagesBeforeCount + 1, count(NotificationMessage::getAll()));
     // Check export job, when many ids are selected.
     // This will probably never happen, but we need test for this case too.
     $notificationsBeforeCount = count(Notification::getAll());
     $notificationMessagesBeforeCount = count(NotificationMessage::getAll());
     // Now test case when multiple ids are selected
     $exportItems = ExportItem::getAll();
     if (count($exportItems)) {
         foreach ($exportItems as $exportItem) {
             $exportItem->delete();
         }
     }
     $selectedIds = "";
     foreach ($opportunities as $opportunity) {
         $selectedIds .= $opportunity->id . ",";
         // Not Coding Standard
     }
     $this->setGetArray(array('OpportunitiesSearchForm' => array('anyMixedAttributesScope' => array(0 => 'All'), 'anyMixedAttributes' => '', 'name' => '', 'officePhone' => ''), 'Opportunity_page' => '1', 'export' => '', 'ajax' => '', 'selectAll' => '', 'selectedIds' => "{$selectedIds}"));
     $this->runControllerWithRedirectExceptionAndGetUrl('opportunities/default/export');
     // Start background job
     $job = new ExportJob();
     $this->assertTrue($job->run());
     $exportItems = ExportItem::getAll();
     $this->assertEquals(1, count($exportItems));
     $fileModel = $exportItems[0]->exportFileModel;
     $this->assertEquals(1, $exportItems[0]->isCompleted);
     $this->assertEquals('csv', $exportItems[0]->exportFileType);
     $this->assertEquals('opportunities', $exportItems[0]->exportFileName);
     $this->assertTrue($fileModel instanceof ExportFileModel);
     $this->assertEquals($notificationsBeforeCount + 1, count(Notification::getAll()));
     $this->assertEquals($notificationMessagesBeforeCount + 1, count(NotificationMessage::getAll()));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:64,代码来源:OpportunitiesSuperUserExportWalkthroughTest.php

示例5: testRegularMassDeletePagesProperlyAndRemovesAllSelected

 /**
  *Test Bug with mass delete and multiple pages when using select all
  */
 public function testRegularMassDeletePagesProperlyAndRemovesAllSelected()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $confused = User::getByUsername('confused');
     $nobody = User::getByUsername('nobody');
     //Load MassDelete view for the 8 opportunities.
     $opportunities = Opportunity::getAll();
     $this->assertEquals(9, count($opportunities));
     //Deleting all opportunities
     //mass Delete pagination scenario
     //Run Mass Delete using progress save for page1
     $this->setGetArray(array('selectAll' => '1', 'Opportunity_page' => 1));
     $this->setPostArray(array('selectedRecordCount' => 9));
     $pageSize = Yii::app()->pagination->getForCurrentUserByType('massDeleteProgressPageSize');
     $this->assertEquals(5, $pageSize);
     $content = $this->runControllerWithExitExceptionAndGetContent('opportunities/default/massDelete');
     $opportunities = Opportunity::getAll();
     $this->assertEquals(4, count($opportunities));
     //Run Mass Delete using progress save for page2
     $this->setGetArray(array('selectAll' => '1', 'Opportunity_page' => 2));
     $this->setPostArray(array('selectedRecordCount' => 9));
     $pageSize = Yii::app()->pagination->getForCurrentUserByType('massDeleteProgressPageSize');
     $this->assertEquals(5, $pageSize);
     $content = $this->runControllerWithNoExceptionsAndGetContent('opportunities/default/massDeleteProgress');
     $opportunities = Opportunity::getAll();
     $this->assertEquals(0, count($opportunities));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:30,代码来源:OpportunitiesRegularUserWalkthroughTest.php


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