コード例 #1
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $account);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact2', $super, $account);
     OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp2', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp3', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp4', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp5', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp6', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp7', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp8', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp9', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp10', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp11', $super, $account);
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp12', $super, $account);
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
 }
コード例 #2
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
     ContactsModule::loadStartingData();
     $jimmy = UserTestHelper::createBasicUserWithEmailAddress('jimmy');
     self::$jimmy = $jimmy;
 }
コード例 #3
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
     OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp', $super, $account);
 }
コード例 #4
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     UserTestHelper::createBasicUser('jim');
     AllPermissionsOptimizationUtil::rebuild();
     OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
     OpportunityTestHelper::createOpportunitySourcesIfDoesNotExist();
     $currencies = Currency::getAll();
     //Make opportunities for testing chart data.
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 200;
     $currencyValue->currency = $currencies[0];
     $opportunity = new Opportunity();
     $opportunity->owner = $super;
     $opportunity->name = 'abc1';
     $opportunity->amount = $currencyValue;
     $opportunity->closeDate = '2011-01-01';
     $opportunity->stage->value = 'Negotiating';
     $opportunity->source->value = 'Outbound';
     assert($opportunity->save());
     // Not Coding Standard
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 350;
     $currencyValue->currency = $currencies[0];
     $opportunity = new Opportunity();
     $opportunity->owner = $super;
     $opportunity->name = 'abc2';
     $opportunity->amount = $currencyValue;
     $opportunity->closeDate = '2011-01-01';
     $opportunity->stage->value = 'Negotiating';
     $opportunity->source->value = 'Trade Show';
     assert($opportunity->save());
     // Not Coding Standard
     $currencyValue = new CurrencyValue();
     $currencyValue->value = 100;
     $currencyValue->currency = $currencies[0];
     $opportunity = new Opportunity();
     $opportunity->owner = $super;
     $opportunity->name = 'abc2';
     $opportunity->amount = $currencyValue;
     $opportunity->closeDate = '2011-01-01';
     $opportunity->stage->value = 'Verbal';
     $opportunity->source->value = 'Trade Show';
     assert($opportunity->save());
     // Not Coding Standard
 }
コード例 #5
0
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     SecurityTestHelper::createSuperAdmin();
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
     $opportunity = OpportunityTestHelper::createOpportunityByNameForOwner('superOpportunity', $super);
     $productTemplate = ProductTemplateTestHelper::createProductTemplateByName('superProductTemplate');
     $contactWithNoAccount = ContactTestHelper::createContactByNameForOwner('noAccountContact', $super);
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     $everyoneGroup->save();
 }
 public static function setUpBeforeClass()
 {
     parent::setUpBeforeClass();
     //Setup test data owned by the super user.
     $super = Yii::app()->user->userModel;
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     AccountTestHelper::createAccountByNameForOwner('superAccount2', $super);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $account);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact2', $super, $account);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact3', $super, $account);
     ContactTestHelper::createContactWithAccountByNameForOwner('superContact4', $super, $account);
     OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
     OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp', $super, $account);
     //Setup default dashboard.
     Dashboard::getByLayoutIdAndUser(Dashboard::DEFAULT_USER_LAYOUT_ID, $super);
     //Make contact DetailsAndRelations portlets
     AllPermissionsOptimizationUtil::rebuild();
 }
コード例 #7
0
 public function testForgettingAModelWithAddingAManyToManyRelation()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     //Setup test data owned by the super user.
     $account = AccountTestHelper::createAccountByNameForOwner('superAccount', $super);
     $contact = ContactTestHelper::createContactWithAccountByNameForOwner('superContact', $super, $account);
     $contactId = $contact->id;
     OpportunityTestHelper::createOpportunityStagesIfDoesNotExist();
     $opportunity = OpportunityTestHelper::createOpportunityWithAccountByNameForOwner('superOpp', $super, $account);
     $opportunityId = $opportunity->id;
     //Model forgets ok.
     $contact->forget();
     $contact = Contact::getById($contactId);
     $opportunity->contacts->add($contact);
     $opportunity->save();
     //Still forgets ok, because we are forgetting both opportunity and contact. If we forget just contact,
     //it would break later when you try to look at $contact->oppportunities or $opportunity->contacts
     $contact->forget();
     $opportunity->forget();
     $contact = Contact::getById($contactId);
     $opportunity = Opportunity::getById($opportunityId);
     //Finds many-to-many relationships ok on both sides
     $this->assertEquals(1, $opportunity->contacts->count());
     $this->assertEquals(1, $contact->opportunities->count());
     $this->assertEquals($opportunity, $contact->opportunities[0]);
     $this->assertEquals($contact, $opportunity->contacts[0]);
 }