本文整理汇总了PHP中AccountTestHelper::createAccountbyNameForOwner方法的典型用法代码示例。如果您正苦于以下问题:PHP AccountTestHelper::createAccountbyNameForOwner方法的具体用法?PHP AccountTestHelper::createAccountbyNameForOwner怎么用?PHP AccountTestHelper::createAccountbyNameForOwner使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AccountTestHelper
的用法示例。
在下文中一共展示了AccountTestHelper::createAccountbyNameForOwner方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: testSuperUserConvertAction
/**
* @depends testSuperUserCreateAction
*/
public function testSuperUserConvertAction()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$startingLeadState = LeadsUtil::getStartingState();
$startingContactState = ContactsUtil::getStartingState();
$leads = Contact::getByName('myNewLead myNewLeadson');
$this->assertEquals(1, count($leads));
$lead = $leads[0];
$this->assertTrue($lead->state == $startingLeadState);
//Test just going to the convert page.
$this->setGetArray(array('id' => $lead->id));
$this->resetPostArray();
//Test trying to convert by skipping account creation
$this->runControllerWithNoExceptionsAndGetContent('leads/default/convert');
$this->setGetArray(array('id' => $lead->id));
$this->setPostArray(array('AccountSkip' => 'Not Used'));
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convert');
$leadId = $lead->id;
$lead->forget();
$contact = Contact::getById($leadId);
$this->assertTrue($contact->state == $startingContactState);
//Test trying to convert by creating a new account.
$lead5 = LeadTestHelper::createLeadbyNameForOwner('superLead5', $super);
$this->assertTrue($lead5->state == $startingLeadState);
$this->setGetArray(array('id' => $lead5->id));
$this->setPostArray(array('Account' => array('name' => 'someAccountName')));
$this->assertEquals(0, count(Account::getAll()));
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convert');
$this->assertEquals(1, count(Account::getAll()));
$lead5Id = $lead5->id;
$lead5->forget();
$contact5 = Contact::getById($lead5Id);
$this->assertTrue($contact5->state == $startingContactState);
$this->assertEquals('someAccountName', $contact5->account->name);
//Test trying to convert by selecting an existing account
$account = AccountTestHelper::createAccountbyNameForOwner('someNewAccount', $super);
$lead6 = LeadTestHelper::createLeadbyNameForOwner('superLead6', $super);
$this->assertTrue($lead6->state == $startingLeadState);
$this->setGetArray(array('id' => $lead6->id));
$this->setPostArray(array('AccountSelectForm' => array('accountId' => $account->id, 'accountName' => 'someNewAccount')));
$this->assertEquals(2, count(Account::getAll()));
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convert');
$this->assertEquals(2, count(Account::getAll()));
$lead6Id = $lead6->id;
$lead6->forget();
$contact6 = Contact::getById($lead6Id);
$this->assertTrue($contact6->state == $startingContactState);
$this->assertEquals($account, $contact6->account);
}
示例2: testSuperUserConvertAction
/**
* @depends testSuperUserCreateAction
*/
public function testSuperUserConvertAction()
{
$super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
$startingLeadState = LeadsUtil::getStartingState();
$startingContactState = ContactsUtil::getStartingState();
$leads = Contact::getByName('myNewLead myNewLeadson');
$this->assertEquals(1, count($leads));
$lead = $leads[0];
$this->assertTrue($lead->state == $startingLeadState);
//Test just going to the convert page.
$this->setGetArray(array('id' => $lead->id));
$this->resetPostArray();
//Test trying to convert by skipping account creation and by skipping opportunity creation
$this->runControllerWithNoExceptionsAndGetContent('leads/default/convert');
$this->setGetArray(array('id' => $lead->id));
$this->setPostArray(array('AccountSkip' => 'Not Used'));
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convert');
$this->setGetArray(array('id' => $lead->id));
$this->setPostArray(array('OpportunitySkip' => 'Not Used'));
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convertFinal');
$leadId = $lead->id;
$lead->forget();
$contact = Contact::getById($leadId);
$this->assertTrue($contact->state == $startingContactState);
//Test trying to convert by creating a new account and by skipping opportunity creation.
$lead5 = LeadTestHelper::createLeadbyNameForOwner('superLead5', $super);
$this->assertTrue($lead5->state == $startingLeadState);
$this->setGetArray(array('id' => $lead5->id));
$this->setPostArray(array('Account' => array('name' => 'someAccountName')));
$this->assertEquals(0, Account::getCount());
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convert');
$this->setGetArray(array('id' => $lead5->id));
$this->setPostArray(array('OpportunitySkip' => 'Not Used'));
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convertFinal');
$this->assertEquals(1, Account::getCount());
$lead5Id = $lead5->id;
$lead5->forget();
$contact5 = Contact::getById($lead5Id);
$this->assertTrue($contact5->state == $startingContactState);
$this->assertEquals('someAccountName', $contact5->account->name);
//Test trying to convert by selecting an existing account and by skipping opportunity creation.
$account = AccountTestHelper::createAccountbyNameForOwner('someNewAccount', $super);
$lead6 = LeadTestHelper::createLeadbyNameForOwner('superLead6', $super);
$this->assertTrue($lead6->state == $startingLeadState);
$this->setGetArray(array('id' => $lead6->id));
$this->setPostArray(array('AccountSelectForm' => array('accountId' => $account->id, 'accountName' => 'someNewAccount')));
$this->assertEquals(2, Account::getCount());
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convert');
$this->setGetArray(array('id' => $lead6->id));
$this->setPostArray(array('OpportunitySkip' => 'Not Used'));
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convertFinal');
$this->assertEquals(2, Account::getCount());
$lead6Id = $lead6->id;
$lead6->forget();
$contact6 = Contact::getById($lead6Id);
$this->assertTrue($contact6->state == $startingContactState);
$this->assertEquals($account, $contact6->account);
//Test trying to convert by skipping account creation and by creating new opportunity
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convert');
$leadOpp = LeadTestHelper::createLeadbyNameForOwner('superLeadOpp', $super);
$this->setGetArray(array('id' => $leadOpp->id));
$this->setPostArray(array('AccountSkip' => 'Not Used'));
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convert');
$this->setGetArray(array('id' => $leadOpp->id));
$this->setPostArray(array('Opportunity' => array('name' => 'someOpportunityName', 'amount' => array('currency' => array('id' => '1'), 'value' => '100'), 'closeDate' => '6/19/2014', 'stage' => array('value' => 'Negotiating'), 'probability' => '50')));
$this->assertEquals(0, Opportunity::getCount());
$this->assertEquals(2, Account::getCount());
$this->runControllerWithRedirectExceptionAndGetContent('leads/default/convertFinal');
$leadId = $leadOpp->id;
$leadOpp->forget();
$contact = Contact::getById($leadId);
$this->assertTrue($contact->state == $startingContactState);
$this->assertEquals(1, Opportunity::getCount());
$this->assertEquals(2, Account::getCount());
}