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


PHP Account::getAll方法代码示例

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


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

示例1: testUnlinkContactForAccount

 public function testUnlinkContactForAccount()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $simpleUser = User::getByUsername('simpleUser');
     Yii::app()->user->userModel = $simpleUser;
     $simpleUser->setRight('AccountsModule', AccountsModule::RIGHT_ACCESS_ACCOUNTS);
     $simpleUser->setRight('AccountsModule', AccountsModule::RIGHT_CREATE_ACCOUNTS);
     $simpleUser->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     $simpleUser->setRight('ContactsModule', ContactsModule::RIGHT_ACCESS_CONTACTS);
     $this->assertTrue($simpleUser->save());
     $account = AccountTestHelper::createAccountByNameForOwner('simpleUserAccount', $simpleUser);
     $contact = ContactTestHelper::createContactWithAccountByNameForOwner('simpleUserContact', $simpleUser, $account);
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     $contacts = Contact::getAll();
     $this->assertEquals(1, count($contacts));
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'simpleUserAccount');
     $this->setGetArray(array('id' => $superAccountId));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
     $contactId = self::getModelIdByModelNameAndName('Contact', 'simpleUserContact simpleUserContactson');
     //unlinking the contact
     $this->setGetArray(array('id' => $contactId, 'relationModelClassName' => 'Account', 'relationModelId' => $superAccountId, 'relationModelRelationName' => 'contacts'));
     $content = $this->runControllerWithNoExceptionsAndGetContent('contacts/default/unlink', true);
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     $contacts = Contact::getAll();
     $contactId = $contacts[0]->id;
     $contacts[0]->forget();
     $contact = Contact::getById($contactId);
     $this->assertTrue($contact->account->id < 0);
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:32,代码来源:AccountsRegularUserUnlinkWalkthroughTest.php

示例2: testRebuildDatabaseWithNonSuperAdminUser

 public function testRebuildDatabaseWithNonSuperAdminUser()
 {
     $steven = UserTestHelper::createBasicUser('Steven');
     Yii::app()->user->userModel = $steven;
     $item = NamedSecurableItem::getByName('AccountsModule');
     $this->assertEquals(Permission::NONE, $item->getEffectivePermissions($steven));
     $accounts = Account::getAll();
     $users = User::getAll();
     $this->assertEquals(0, count($accounts));
     $this->assertEquals(2, count($users));
     $adapter = new ModelAttributesAdapter(new Account());
     $adapter->resolveDatabaseSchemaForModel('Account');
     //Confirm the counts of data are still correct
     $accounts = Account::getAll();
     $users = User::getAll();
     $this->assertEquals(0, count($accounts));
     $this->assertEquals(2, count($users));
     //Explicitly deny read, write, and deny
     Yii::app()->user->userModel = User::getByUsername('super');
     $item->addPermissions($steven, Permission::READ_WRITE_DELETE, Permission::DENY);
     $this->assertTrue($item->save());
     //Make sure steven has explicit deny
     $item = NamedSecurableItem::getByName('AccountsModule');
     $this->assertEquals(Permission::NONE, $item->getEffectivePermissions($steven));
     Yii::app()->user->userModel = $steven;
     $adapter = new ModelAttributesAdapter(new Account());
     $adapter->resolveDatabaseSchemaForModel('Account');
     //Confirm the counts of data are still correct
     $accounts = Account::getAll();
     $users = User::getAll();
     $this->assertEquals(0, count($accounts));
     $this->assertEquals(2, count($users));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:33,代码来源:DesignerRedBeanDatabaseBuilderUtilTest.php

示例3: testGetAll

 /**
  * Getting a list of all objects should not fail.
  *
  * @return BbObject[]
  */
 public function testGetAll()
 {
     $at = getenv("BB_ACCESS_TOKEN");
     $objects = Account::getAll($at);
     $this->assertContainsOnlyInstancesOf('\\ClausConrad\\BillysBilling\\Account', $objects, 'Getting all returns only objects of this type.');
     return $objects;
 }
开发者ID:cconrad,项目名称:billysbilling-v2-php-sdk,代码行数:12,代码来源:AccountTest.php

示例4: testSuperUserAllDefaultControllerActions

 public function testSuperUserAllDefaultControllerActions()
 {
     // key used to test persistance of user settings
     $configKey = 'rollup';
     //Set the current user as the super user.
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     //Load Details view to generate the portlets.
     $this->setGetArray(array('id' => $superAccountId));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
     //Find the LatestActivity portlet.
     $portletToUse = null;
     $portlets = Portlet::getAll();
     foreach ($portlets as $portlet) {
         if ($portlet->viewType == 'AccountLatestActivitiesForPortlet') {
             $portletToUse = $portlet;
             break;
         }
     }
     $this->assertNotNull($portletToUse);
     $this->assertEquals('AccountLatestActivitiesForPortletView', get_class($portletToUse->getView()));
     //Load the portlet details for latest activity
     $getData = array('id' => $superAccountId, 'portletId' => $portletToUse->id, 'uniqueLayoutId' => 'AccountDetailsAndRelationsView_' . $portletToUse->id, 'LatestActivitiesConfigurationForm' => array('filteredByModelName' => 'all', 'rollup' => ''));
     $this->setGetArray($getData);
     $this->resetPostArray();
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $this->assertTrue(LatestActivitiesPortletPersistentConfigUtil::getForCurrentUserByPortletIdAndKey($getData['portletId'], $configKey) === '');
     //Now add roll up
     $getData['LatestActivitiesConfigurationForm']['rollup'] = '1';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $this->assertTrue(LatestActivitiesPortletPersistentConfigUtil::getForCurrentUserByPortletIdAndKey($getData['portletId'], $configKey) === '1');
     //Now filter by meeting, task, and note
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Meeting';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Note';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Task';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     //Now do the same thing with filtering but turn off rollup.
     $getData['LatestActivitiesConfigurationForm']['rollup'] = '';
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Meeting';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $this->assertTrue(LatestActivitiesPortletPersistentConfigUtil::getForCurrentUserByPortletIdAndKey($getData['portletId'], $configKey) === '');
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Note';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
     $getData['LatestActivitiesConfigurationForm']['filteredByModelName'] = 'Task';
     $this->setGetArray($getData);
     $content = $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/details');
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:58,代码来源:AccountLatestActivitiesSuperUserWalkthroughTest.php

示例5: teardown

 public function teardown()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $accounts = Account::getAll();
     foreach ($accounts as $account) {
         $account->delete();
     }
     parent::teardown();
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:10,代码来源:StarredUtilTest.php

示例6: testSuperUserDerivedExplicitReadWriteModelPermissionsEditExistingAccount

 public function testSuperUserDerivedExplicitReadWriteModelPermissionsEditExistingAccount()
 {
     //Set the current user as the super user.
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts[0]));
     $this->assertEquals(0, count($accounts[0]->permissions));
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     $group1 = Group::getByName('Group1');
     $everyoneGroup = Group::getByName(Group::EVERYONE_GROUP_NAME);
     //Save account and add a non-everyone group permission.
     //Permissions is the only thing changing on the account.
     $this->setGetArray(array('id' => $superAccountId));
     $postData = array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_NONEVERYONE_GROUP, 'nonEveryoneGroup' => $group1->id);
     $this->setPostArray(array('Account' => array('explicitReadWriteModelPermissions' => $postData)));
     //Make sure the redirect is to the details view and not the list view.
     $this->runControllerWithRedirectExceptionAndGetContent('accounts/default/edit', Yii::app()->createUrl('accounts/default/details', array('id' => $superAccountId)));
     //Confirm the permissions are set right based on how the account was saved.
     $accounts[0]->forget();
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Account::getById($superAccountId));
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals(1, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
     $this->assertEquals($group1, $readWritePermitables[$group1->id]);
     //Change the permissions to Everyone group
     $this->setGetArray(array('id' => $superAccountId));
     $postData = array('type' => ExplicitReadWriteModelPermissionsUtil::MIXED_TYPE_EVERYONE_GROUP);
     $this->setPostArray(array('Account' => array('explicitReadWriteModelPermissions' => $postData)));
     //Make sure the redirect is to the details view and not the list view.
     $this->runControllerWithRedirectExceptionAndGetContent('accounts/default/edit', Yii::app()->createUrl('accounts/default/details', array('id' => $superAccountId)));
     //Confirm the permissions are set right based on how the account was saved.
     $accounts[0]->forget();
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Account::getById($superAccountId));
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals(1, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
     $this->assertEquals($everyoneGroup, $readWritePermitables[$everyoneGroup->id]);
     //Remove all explicit permissions.
     $this->setGetArray(array('id' => $superAccountId));
     $postData = array('type' => null);
     $this->setPostArray(array('Account' => array('explicitReadWriteModelPermissions' => $postData)));
     //Make sure the redirect is to the details view and not the list view.
     $this->runControllerWithRedirectExceptionAndGetContent('accounts/default/edit', Yii::app()->createUrl('accounts/default/details', array('id' => $superAccountId)));
     //Confirm the permissions are set right based on how the account was saved.
     $accounts[0]->forget();
     $explicitReadWriteModelPermissions = ExplicitReadWriteModelPermissionsUtil::makeBySecurableItem(Account::getById($superAccountId));
     $readWritePermitables = $explicitReadWriteModelPermissions->getReadWritePermitables();
     $readOnlyPermitables = $explicitReadWriteModelPermissions->getReadOnlyPermitables();
     $this->assertEquals(0, count($readWritePermitables));
     $this->assertEquals(0, count($readOnlyPermitables));
 }
开发者ID:youprofit,项目名称:Zurmo,代码行数:53,代码来源:AccountPermissionsSuperUserWalkthroughTest.php

示例7: testAddingMapPortletToAccountsDetailView

 public function testAddingMapPortletToAccountsDetailView()
 {
     //Lougout previous use and log in as super user
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     //Retriving the super account id.
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     //Create address array for the super account id.
     $address = array('street1' => '123 Knob Street', 'street2' => 'Apartment 4b', 'city' => 'Chicago', 'state' => 'Illinois', 'postalCode' => '60606', 'country' => 'USA');
     //Assign Address to the super user account.
     AddressGeoCodeTestHelper::updateTestAccountsWithBillingAddress($superAccountId, $address, $super);
     //Fetch Latitute and Longitude values for address and save in Address.
     AddressMappingUtil::updateChangedAddresses();
     $accounts = Account::getByName('superAccount');
     $this->assertEquals(1, count($accounts));
     $this->assertEquals(round('41.8817767', 4), round($accounts[0]->billingAddress->latitude, 4));
     $this->assertEquals(round('-87.6371461', 4), round($accounts[0]->billingAddress->longitude, 4));
     $this->assertEquals(0, $accounts[0]->billingAddress->invalid);
     $addressString = $accounts[0]->billingAddress->makeAddress();
     $this->setGetArray(array('addressString' => $addressString, 'latitude' => $accounts[0]->billingAddress->latitude, 'longitude' => $accounts[0]->billingAddress->longitude));
     $content = $this->runControllerWithNoExceptionsAndGetContent('maps/default/mapAndPoint');
     $this->assertContains('plotMap', $content);
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     //Load Model Detail Views
     $this->setGetArray(array('id' => $superAccountId, 'lockPortlets' => '0'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(3, count($portlets[1]));
     $this->assertFalse(array_key_exists(3, $portlets));
     $this->assertEquals(4, count($portlets[2]));
     foreach ($portlets[2] as $position => $portlet) {
         $portlet->delete();
     }
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
     $this->assertFalse(array_key_exists(2, $portlets));
     $this->setGetArray(array('modelId' => $superAccountId, 'uniqueLayoutId' => 'AccountDetailsAndRelationsView', 'portletType' => 'MapForAccountAddress', 'redirect' => '0'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/add', true);
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(1, count($portlets[2]));
     //Load Model Detail Views
     $this->setGetArray(array('id' => $superAccountId, 'lockPortlets' => '0'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:46,代码来源:MapsPortletSuperUserWalkthroughTest.php

示例8: overwriteForm

 public function overwriteForm($return, $returnfull)
 {
     $r = new Role();
     $arr = $r->getAll();
     foreach ($arr as $rol) {
         if ($rol->role_active) {
             $arrNew[$rol->role_id] = $rol->role_id;
         }
     }
     $acc = new Account();
     $acc->default_read_coloms = "admin_id,admin_nama_depan,admin_aktiv";
     $arr = $acc->getAll();
     foreach ($arr as $ac) {
         if ($ac->admin_aktiv) {
             $arrNew2[$ac->admin_id] = $ac->admin_id . " - " . $ac->admin_nama_depan;
         }
     }
     $return['role_admin_id'] = new Leap\View\InputSelect($arrNew2, "role_admin_id", "role_admin_id", $this->role_admin_id);
     $return['role_id'] = new Leap\View\InputSelect($arrNew, "role_id", "role_id", $this->role_id);
     $return['account_username'] = new Leap\View\InputText("hidden", "account_username", "account_username", $this->account_username);
     return $return;
 }
开发者ID:CapsuleCorpIndonesia,项目名称:elang-combo,代码行数:22,代码来源:Role2Account.php

示例9: testAdditionOfPortletsInEmptyRightPanel

 public function testAdditionOfPortletsInEmptyRightPanel()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $superAccountId = self::getModelIdByModelNameAndName('Account', 'superAccount');
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     //Load Model Detail Views
     $this->setGetArray(array('id' => $superAccountId, 'lockPortlets' => '0'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/default/details');
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(3, count($portlets[1]));
     $this->assertFalse(array_key_exists(3, $portlets));
     $this->assertEquals(4, count($portlets[2]));
     foreach ($portlets[2] as $position => $portlet) {
         $portlet->delete();
     }
     $this->setGetArray(array('modelId' => $superAccountId, 'uniqueLayoutId' => 'AccountDetailsAndRelationsView', 'portletType' => 'ProductsForAccountRelatedList', 'redirect' => '0'));
     $this->resetPostArray();
     $this->runControllerWithNoExceptionsAndGetContent('accounts/defaultPortlet/add', true);
     $portlets = Portlet::getByLayoutIdAndUserSortedByColumnIdAndPosition('AccountDetailsAndRelationsView', $super->id, array());
     $this->assertEquals(1, count($portlets[2]));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:23,代码来源:AccountDetailsAndRelationsPortletViewTest.php

示例10: testExportWithSelectAllForMoreThan10Records

 public function testExportWithSelectAllForMoreThan10Records()
 {
     $super = $this->logoutCurrentUserLoginNewUserAndGetByUsername('super');
     $accounts = Account::getAll();
     foreach ($accounts as $account) {
         $account->delete();
     }
     $exportItems = ExportItem::getAll();
     foreach ($exportItems as $exportItem) {
         $exportItem->delete();
     }
     $numberOfRecords = rand(12, 100);
     ExportModule::$asynchronusThreshold = $numberOfRecords - 1;
     for ($i = 1; $i <= $numberOfRecords; $i++) {
         $randomData = RandomDataUtil::getRandomDataByModuleAndModelClassNames('AccountsModule', 'Account');
         AccountTestHelper::createAccountByNameForOwner($randomData['names'][$i], $super);
     }
     $this->setGetArray(array('Account_page' => '1', 'export' => '', 'selectAll' => '1', 'selectedIds' => '', 'ajax' => ''));
     $this->runControllerWithRedirectExceptionAndGetUrl('accounts/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('accounts', $exportItems[0]->exportFileName);
     $this->assertTrue($fileModel instanceof ExportFileModel);
     for ($i = 1; $i <= $numberOfRecords; $i++) {
         $this->assertContains($randomData['names'][$i], $fileModel->fileContent->content);
     }
 }
开发者ID:sandeep1027,项目名称:zurmo_,代码行数:33,代码来源:AccountsSuperUserExportWalkthroughTest.php

示例11: testOnCreateOwnerChangeAndDeleteAccountModel

 public function testOnCreateOwnerChangeAndDeleteAccountModel()
 {
     $super = User::getByUsername('super');
     $billy = self::$billy;
     Yii::app()->user->userModel = $super;
     $job = new ReadPermissionSubscriptionUpdateForAccountFromBuildTableJob();
     Yii::app()->jobQueue->deleteAll();
     // Clean contact table
     $sql = "SELECT * FROM account_read_subscription";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertTrue(empty($rows));
     $account1 = AccountTestHelper::createAccountByNameForOwner('First Account', $super);
     sleep(1);
     $queuedJobs = Yii::app()->jobQueue->getAll();
     $this->assertEquals(1, count($queuedJobs[5]));
     $this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
     Yii::app()->jobQueue->deleteAll();
     $this->assertTrue($job->run());
     $sql = "SELECT * FROM account_read_subscription order by userid";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertEquals(2, count($rows));
     $this->assertEquals($super->id, $rows[0]['userid']);
     $this->assertEquals($account1->id, $rows[0]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[0]['subscriptiontype']);
     $this->assertEquals($billy->id, $rows[1]['userid']);
     $this->assertEquals($account1->id, $rows[1]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[1]['subscriptiontype']);
     sleep(1);
     // Test deletion
     $account1->delete();
     sleep(1);
     $queuedJobs = Yii::app()->jobQueue->getAll();
     $this->assertEquals(1, count($queuedJobs[5]));
     $this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
     Yii::app()->jobQueue->deleteAll();
     $this->assertTrue($job->run());
     $sql = "SELECT * FROM account_read_subscription order by userid";
     $rows2 = ZurmoRedBean::getAll($sql);
     $this->assertEquals(2, count($rows2));
     $this->assertEquals($super->id, $rows2[0]['userid']);
     $this->assertEquals($account1->id, $rows2[0]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_DELETE, $rows2[0]['subscriptiontype']);
     $this->assertNotEquals($rows[0]['modifieddatetime'], $rows2[0]['modifieddatetime']);
     $this->assertEquals($billy->id, $rows2[1]['userid']);
     $this->assertEquals($account1->id, $rows2[1]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_DELETE, $rows2[1]['subscriptiontype']);
     $this->assertNotEquals($rows[1]['modifieddatetime'], $rows2[1]['modifieddatetime']);
     // Test owner change, but when both users have permissions to access the account
     $sql = "DELETE FROM account_read_subscription";
     ZurmoRedBean::exec($sql);
     $sql = "SELECT * FROM account_read_subscription";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertTrue(empty($rows));
     $account2 = AccountTestHelper::createAccountByNameForOwner('Second Account', $super);
     sleep(1);
     $queuedJobs = Yii::app()->jobQueue->getAll();
     $this->assertEquals(1, count($queuedJobs[5]));
     $this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
     Yii::app()->jobQueue->deleteAll();
     $this->assertTrue($job->run());
     $sql = "SELECT * FROM account_read_subscription order by userid";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertEquals(2, count($rows));
     $this->assertEquals($super->id, $rows[0]['userid']);
     $this->assertEquals($account2->id, $rows[0]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[0]['subscriptiontype']);
     $this->assertEquals($billy->id, $rows[1]['userid']);
     $this->assertEquals($account2->id, $rows[1]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[1]['subscriptiontype']);
     sleep(1);
     $account2->owner = self::$billy;
     $this->assertTrue($account2->save());
     sleep(1);
     $queuedJobs = Yii::app()->jobQueue->getAll();
     $this->assertEquals(1, count($queuedJobs[5]));
     $this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
     Yii::app()->jobQueue->deleteAll();
     $this->assertTrue($job->run());
     $sql = "SELECT * FROM account_read_subscription order by userid";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertEquals(2, count($rows));
     $this->assertEquals($super->id, $rows[0]['userid']);
     $this->assertEquals($account2->id, $rows[0]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[0]['subscriptiontype']);
     $this->assertEquals(self::$billy->id, $rows[1]['userid']);
     $this->assertEquals($account2->id, $rows[1]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[1]['subscriptiontype']);
     // Clean account table
     $accounts = Account::getAll();
     foreach ($accounts as $account) {
         $account->delete();
     }
     $sql = "DELETE FROM account_read_subscription";
     ZurmoRedBean::exec($sql);
     $johnny = self::$johnny;
     $account3 = AccountTestHelper::createAccountByNameForOwner('Third Account', $johnny);
     sleep(1);
     $queuedJobs = Yii::app()->jobQueue->getAll();
     $this->assertEquals(1, count($queuedJobs[5]));
     $this->assertEquals('ReadPermissionSubscriptionUpdateForAccountFromBuildTable', $queuedJobs[5][0]['jobType']);
//.........这里部分代码省略.........
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:101,代码来源:ReadPermissionSubscriptionObserverTest.php

示例12: testExportReportWithMultiplePagesOfData

 /**
  * @depends testExportByModelIds
  */
 public function testExportReportWithMultiplePagesOfData()
 {
     $super = User::getByUsername('super');
     Yii::app()->user->userModel = $super;
     $numberOfUserNotifications = Notification::getCountByTypeAndUser('ExportProcessCompleted', Yii::app()->user->userModel);
     $report = new Report();
     $report->setType(Report::TYPE_ROWS_AND_COLUMNS);
     $report->setModuleClassName('AccountsModule');
     $report->setFiltersStructure('');
     $displayAttribute = new DisplayAttributeForReportForm('AccountsModule', 'Account', Report::TYPE_ROWS_AND_COLUMNS);
     $displayAttribute->setModelAliasUsingTableAliasName('model1');
     $displayAttribute->attributeIndexOrDerivedType = 'name';
     $report->addDisplayAttribute($displayAttribute);
     $dataProvider = new RowsAndColumnsReportDataProvider($report);
     $exportItem = new ExportItem();
     $exportItem->isCompleted = 0;
     $exportItem->exportFileType = 'csv';
     $exportItem->exportFileName = 'rowAndColumnsTest2';
     $exportItem->modelClassName = 'SavedReport';
     $exportItem->serializedData = ExportUtil::getSerializedDataForExport($dataProvider);
     $this->assertTrue($exportItem->save());
     $id = $exportItem->id;
     $exportItem->forget();
     unset($exportItem);
     //Delete queued jobs from test exportItems created above
     Yii::app()->jobQueue->deleteAll();
     ExportModule::$asynchronousPageSize = 2;
     $job = new ExportJob();
     $this->assertEquals(0, count(Yii::app()->jobQueue->getAll()));
     $this->assertTrue($job->run());
     $this->assertEquals(0, count(Yii::app()->jobQueue->getAll()));
     $exportItem = ExportItem::getById($id);
     $fileModel = $exportItem->exportFileModel;
     $this->assertEquals(1, $exportItem->isCompleted);
     $this->assertEquals(0, $exportItem->processOffset);
     $this->assertEquals('csv', $exportItem->exportFileType);
     $this->assertEquals('rowAndColumnsTest2', $exportItem->exportFileName);
     $this->assertTrue($fileModel instanceof ExportFileModel);
     $accounts = Account::getAll();
     $headerData = array('Name');
     $data = array();
     foreach ($accounts as $account) {
         $data[] = array($account->name);
     }
     $output = ExportItemToCsvFileUtil::export($data, $headerData, 'rowAndColumnsTest2.csv', false);
     $this->assertEquals($output, $fileModel->fileContent->content);
     // Check if user got notification message, and if its type is ExportProcessCompleted
     $this->assertEquals($numberOfUserNotifications + 1, Notification::getCountByTypeAndUser('ExportProcessCompleted', Yii::app()->user->userModel));
     //Matrix report should not paginate
     $report = new Report();
     $report->setType(Report::TYPE_MATRIX);
     $report->setModuleClassName('AccountsModule');
     $report->setFiltersStructure('');
     $displayAttribute = new DisplayAttributeForReportForm('AccountsModule', 'Account', Report::TYPE_MATRIX);
     $displayAttribute->setModelAliasUsingTableAliasName('model1');
     $displayAttribute->attributeIndexOrDerivedType = 'Count';
     $report->addDisplayAttribute($displayAttribute);
     $groupBy = new GroupByForReportForm('AccountsModule', 'Account', Report::TYPE_MATRIX);
     $groupBy->attributeIndexOrDerivedType = 'name';
     $groupBy->axis = 'y';
     $report->addGroupBy($groupBy);
     $groupBy = new GroupByForReportForm('AccountsModule', 'Account', Report::TYPE_MATRIX);
     $groupBy->attributeIndexOrDerivedType = 'officePhone';
     $report->addGroupBy($groupBy);
     $dataProvider = new MatrixReportDataProvider($report);
     $exportItem = new ExportItem();
     $exportItem->isCompleted = 0;
     $exportItem->exportFileType = 'csv';
     $exportItem->exportFileName = 'matrixTest1';
     $exportItem->modelClassName = 'SavedReport';
     $exportItem->serializedData = ExportUtil::getSerializedDataForExport($dataProvider);
     $this->assertTrue($exportItem->save());
     $id = $exportItem->id;
     $exportItem->forget();
     unset($exportItem);
     //Delete queued jobs from test exportItems created above
     Yii::app()->jobQueue->deleteAll();
     ExportModule::$asynchronousPageSize = 2;
     $job = new ExportJob();
     $this->assertTrue($job->run());
     $exportItem = ExportItem::getById($id);
     $fileModel = $exportItem->exportFileModel;
     $this->assertEquals(1, $exportItem->isCompleted);
     $this->assertEquals(0, $exportItem->processOffset);
     $this->assertEquals('csv', $exportItem->exportFileType);
     $this->assertEquals('matrixTest1', $exportItem->exportFileName);
     $this->assertTrue($fileModel instanceof ExportFileModel);
     $fileContent = $fileModel->fileContent->content;
     $this->assertContains('Test Account', $fileContent);
     $this->assertContains('Test Account 2', $fileContent);
     $this->assertContains('Test Account 3', $fileContent);
     $this->assertContains('Test Account 4', $fileContent);
     // Check if user got notification message, and if its type is ExportProcessCompleted
     $this->assertEquals($numberOfUserNotifications + 2, Notification::getCountByTypeAndUser('ExportProcessCompleted', Yii::app()->user->userModel));
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:98,代码来源:ExportJobTest.php

示例13: testChangeOwnerOfModelInReadSubscriptionTableByModelIdAndModelClassNameAndUser

 public function testChangeOwnerOfModelInReadSubscriptionTableByModelIdAndModelClassNameAndUser()
 {
     $super = User::getByUsername('super');
     $billy = UserTestHelper::createBasicUser('billy');
     Yii::app()->user->userModel = $super;
     // Clean contact table
     $contacts = Contact::getAll();
     foreach ($contacts as $contact) {
         $contact->delete();
     }
     $sql = "DELETE FROM contact_read_subscription";
     ZurmoRedBean::exec($sql);
     $sql = "SELECT * FROM contact_read_subscription";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertTrue(empty($rows));
     $contact1 = ContactTestHelper::createContactByNameForOwner('Ray', $super);
     $sql = "SELECT * FROM contact_read_subscription";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertEquals(0, count($rows));
     ReadPermissionsSubscriptionUtil::updateReadSubscriptionTableByModelClassNameAndUser('Contact', $super, time(), true, new MessageLogger());
     ReadPermissionsSubscriptionUtil::updateReadSubscriptionTableByModelClassNameAndUser('Contact', $billy, time(), true, new MessageLogger());
     $sql = "SELECT * FROM contact_read_subscription";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertEquals(1, count($rows));
     $this->assertEquals($super->id, $rows[0]['userid']);
     $this->assertEquals($contact1->id, $rows[0]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[0]['subscriptiontype']);
     $contact1->owner = $billy;
     $this->assertTrue($contact1->save());
     ReadPermissionsSubscriptionUtil::updateReadSubscriptionTableByModelClassNameAndUser('Contact', $super, time(), true, new MessageLogger());
     ReadPermissionsSubscriptionUtil::updateReadSubscriptionTableByModelClassNameAndUser('Contact', $billy, time(), true, new MessageLogger());
     $sql = "SELECT * FROM contact_read_subscription order by id";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertEquals(2, count($rows));
     $this->assertEquals($super->id, $rows[0]['userid']);
     $this->assertEquals($contact1->id, $rows[0]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_DELETE, $rows[0]['subscriptiontype']);
     $this->assertEquals($billy->id, $rows[1]['userid']);
     $this->assertEquals($contact1->id, $rows[1]['modelid']);
     $this->assertEquals(ReadPermissionsSubscriptionUtil::TYPE_ADD, $rows[1]['subscriptiontype']);
     // Test with accounts - in this case nothing shouldn't change directly during account save() or delete()
     $accounts = Account::getAll();
     foreach ($accounts as $account) {
         $account->delete();
     }
     $sql = "DELETE FROM account_read_subscription";
     ZurmoRedBean::exec($sql);
     $sql = "SELECT * FROM account_read_subscription";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertTrue(empty($rows));
     $account1 = AccountTestHelper::createAccountByNameForOwner("TestAccount2", $super);
     $sql = "SELECT * FROM account_read_subscription";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertTrue(empty($rows));
     $account1->owner = $billy;
     $this->assertTrue($account1->save());
     $sql = "SELECT * FROM account_read_subscription";
     $rows = ZurmoRedBean::getAll($sql);
     $this->assertTrue(empty($rows));
 }
开发者ID:maruthisivaprasad,项目名称:zurmo,代码行数:60,代码来源:ReadPermissionsSubscriptionUtilTest.php

示例14: testAllActions

 public function testAllActions()
 {
     //Ensure that installed = false
     Yii::app()->setApplicationInstalled(false);
     //Check index action.
     $this->runControllerWithNoExceptionsAndGetContent('install/default');
     $this->runControllerWithNoExceptionsAndGetContent('install/default/index');
     //Check welcome action.
     $this->runControllerWithNoExceptionsAndGetContent('install/default/welcome');
     //Check checkSystem action.
     if (isset($_SERVER['SERVER_SOFTWARE'])) {
         $serverSoftware = $_SERVER['SERVER_SOFTWARE'];
     }
     $_SERVER['SERVER_SOFTWARE'] = 'Apache';
     $this->runControllerWithNoExceptionsAndGetContent('install/default/checkSystem');
     //Check settings action.
     $this->runControllerWithNoExceptionsAndGetContent('install/default/settings');
     //Check validateSettings action.
     //First validation will fail, and there should be at least validation errors.
     $this->setPostArray(array('ajax' => 'install-form', 'InstallSettingsForm' => array('databaseHostname' => '', 'databaseAdminUsername' => '', 'databaseAdminPassword' => '', 'databaseName' => '', 'databaseUsername' => '', 'databasePassword' => '', 'databasePort' => '', 'superUserPassword' => '', 'memcacheHostname' => '', 'memcachePortNumber' => '', 'memcacheAvailable' => '', 'databaseType' => 'mysql', 'removeExistingData' => '', 'installDemoData' => '')));
     $content = $this->runControllerWithExitExceptionAndGetContent('install/default/settings');
     $errors = CJSON::decode($content);
     $this->assertGreaterThanOrEqual(5, count($errors));
     $postData = array('ajax' => 'install-form', 'InstallSettingsForm' => array('databaseHostname' => $this->databaseHostname, 'databaseAdminUsername' => '', 'databaseAdminPassword' => '', 'databaseName' => $this->databaseName, 'databaseUsername' => $this->databaseUsername, 'databasePassword' => $this->databasePassword, 'databasePort' => $this->databasePort, 'superUserPassword' => $this->superUserPassword, 'databaseType' => 'mysql', 'removeExistingData' => '1', 'installDemoData' => ''));
     if (MEMCACHE_ON) {
         $memcacheSettings = array('memcacheHostname' => 'localhost', 'memcachePortNumber' => '11211', 'memcacheAvailable' => '1');
     } else {
         $memcacheSettings = array('memcacheHostname' => '', 'memcachePortNumber' => '', 'memcacheAvailable' => '0');
     }
     $postData['InstallSettingsForm'] = array_merge($postData['InstallSettingsForm'], $memcacheSettings);
     $this->setPostArray($postData);
     $content = $this->runControllerWithExitExceptionAndGetContent('install/default/settings');
     $errors = CJSON::decode($content);
     $this->assertEquals(1, count($errors));
     $postData['InstallSettingsForm']['hostInfo'] = 'http://www.example.com';
     $this->setPostArray($postData);
     $content = $this->runControllerWithExitExceptionAndGetContent('install/default/settings');
     $errors = CJSON::decode($content);
     $this->assertEquals(0, count($errors));
     //Run installation.
     $this->setPostArray(array('InstallSettingsForm' => array('databaseHostname' => $this->databaseHostname, 'databaseAdminUsername' => '', 'databaseAdminPassword' => '', 'databaseName' => $this->databaseName, 'databaseUsername' => $this->databaseUsername, 'databasePassword' => $this->databasePassword, 'databasePort' => $this->databasePort, 'superUserPassword' => $this->superUserPassword, 'memcacheHostname' => 'localhost', 'memcachePortNumber' => '11211', 'memcacheAvailable' => '1', 'databaseType' => 'mysql', 'removeExistingData' => '1', 'installDemoData' => '', 'hostInfo' => 'http://www.example.com')));
     //Close db connection(new will be created during installation process).
     RedBeanDatabase::close();
     $this->runControllerWithExitExceptionAndGetContent('install/default/settings');
     $industryFieldData = CustomFieldData::getByName('Industries');
     $this->assertGreaterThan('0', count(unserialize($industryFieldData->serializedData)));
     //Check installDemoData action.
     RedBeanDatabase::close();
     DemoDataUtil::unsetLoadedModules();
     $this->runControllerWithNoExceptionsAndGetContent('install/default/installDemoData');
     $this->assertGreaterThan('0', Account::getAll());
     $this->assertGreaterThan('0', Contact::getAll());
     //Restore $_SERVER['SERVER_SOFTWARE']
     if (isset($serverSoftware)) {
         $_SERVER['SERVER_SOFTWARE'] = $serverSoftware;
     } else {
         unset($_SERVER['SERVER_SOFTWARE']);
     }
 }
开发者ID:RamaKavanan,项目名称:InitialVersion,代码行数:59,代码来源:InstallWalkthroughTest.php

示例15: testSimpleUserImportWhereAllRowsSucceed

 /**
  * @depends testParentAccountHasCorrectAttributeImportType
  */
 public function testSimpleUserImportWhereAllRowsSucceed()
 {
     Yii::app()->user->userModel = User::getByUsername('super');
     $parentAccount = AccountTestHelper::createAccountByNameForOwner('parentAccount', Yii::app()->user->userModel);
     $parentAccountId = $parentAccount->id;
     $accounts = Account::getAll();
     $this->assertEquals(1, count($accounts));
     $import = new Import();
     $serializedData['importRulesType'] = 'Accounts';
     $serializedData['firstRowIsHeaderRow'] = true;
     $import->serializedData = serialize($serializedData);
     $this->assertTrue($import->save());
     ImportTestHelper::createTempTableByFileNameAndTableName('importTest.csv', $import->getTempTableName(), Yii::getPathOfAlias('application.modules.accounts.tests.unit.files'));
     //update the ids of the account column to match the parent account.
     R::exec("update " . $import->getTempTableName() . " set column_16 = " . $parentAccount->id . " where id != 1 limit 4");
     $this->assertEquals(4, ImportDatabaseUtil::getCount($import->getTempTableName()));
     // includes header rows.
     $mappingData = array('column_0' => ImportMappingUtil::makeStringColumnMappingData('name'), 'column_1' => ImportMappingUtil::makeStringColumnMappingData('officePhone'), 'column_2' => ImportMappingUtil::makeStringColumnMappingData('officeFax'), 'column_3' => ImportMappingUtil::makeIntegerColumnMappingData('employees'), 'column_4' => ImportMappingUtil::makeUrlColumnMappingData('website'), 'column_5' => ImportMappingUtil::makeFloatColumnMappingData('annualRevenue'), 'column_6' => ImportMappingUtil::makeTextAreaColumnMappingData('description'), 'column_7' => ImportMappingUtil::makeStringColumnMappingData('billingAddress__city'), 'column_8' => ImportMappingUtil::makeStringColumnMappingData('billingAddress__country'), 'column_9' => ImportMappingUtil::makeStringColumnMappingData('billingAddress__postalCode'), 'column_10' => ImportMappingUtil::makeStringColumnMappingData('billingAddress__state'), 'column_11' => ImportMappingUtil::makeStringColumnMappingData('billingAddress__street1'), 'column_12' => ImportMappingUtil::makeStringColumnMappingData('billingAddress__street2'), 'column_13' => ImportMappingUtil::makeEmailColumnMappingData('primaryEmail__emailAddress'), 'column_14' => ImportMappingUtil::makeBooleanColumnMappingData('primaryEmail__isInvalid'), 'column_15' => ImportMappingUtil::makeBooleanColumnMappingData('primaryEmail__optOut'), 'column_16' => ImportMappingUtil::makeHasOneColumnMappingData('account'), 'column_17' => ImportMappingUtil::makeDropDownColumnMappingData('industry'), 'column_18' => ImportMappingUtil::makeDropDownColumnMappingData('type'));
     $importRules = ImportRulesUtil::makeImportRulesByType('Accounts');
     $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.
     $accounts = Account::getAll();
     $this->assertEquals(4, count($accounts));
     $accounts = Account::getByName('account1');
     $this->assertEquals(1, count($accounts[0]));
     $this->assertEquals(123456, $accounts[0]->officePhone);
     $this->assertEquals(555, $accounts[0]->officeFax);
     $this->assertEquals(1, $accounts[0]->employees);
     $this->assertEquals('http://www.account1.com', $accounts[0]->website);
     $this->assertEquals(100, $accounts[0]->annualRevenue);
     $this->assertEquals('desc1', $accounts[0]->description);
     $this->assertEquals('city1', $accounts[0]->billingAddress->city);
     $this->assertEquals('country1', $accounts[0]->billingAddress->country);
     $this->assertEquals('postal1', $accounts[0]->billingAddress->postalCode);
     $this->assertEquals('state1', $accounts[0]->billingAddress->state);
     $this->assertEquals('street11', $accounts[0]->billingAddress->street1);
     $this->assertEquals('street21', $accounts[0]->billingAddress->street2);
     $this->assertEquals('a@a.com', $accounts[0]->primaryEmail->emailAddress);
     $this->assertEquals(null, $accounts[0]->primaryEmail->isInvalid);
     $this->assertEquals(null, $accounts[0]->primaryEmail->optOut);
     $this->assertTrue($accounts[0]->account->isSame($parentAccount));
     $this->assertEquals('Automotive', $accounts[0]->industry->value);
     $this->assertEquals('Prospect', $accounts[0]->type->value);
     $accounts = Account::getByName('account2');
     $this->assertEquals(1, count($accounts[0]));
     $this->assertEquals(223456, $accounts[0]->officePhone);
     $this->assertEquals(666, $accounts[0]->officeFax);
     $this->assertEquals(2, $accounts[0]->employees);
     $this->assertEquals('http://www.account2.com', $accounts[0]->website);
     $this->assertEquals(200, $accounts[0]->annualRevenue);
     $this->assertEquals('desc2', $accounts[0]->description);
     $this->assertEquals('city2', $accounts[0]->billingAddress->city);
     $this->assertEquals('country2', $accounts[0]->billingAddress->country);
     $this->assertEquals('postal2', $accounts[0]->billingAddress->postalCode);
     $this->assertEquals('state2', $accounts[0]->billingAddress->state);
     $this->assertEquals('street12', $accounts[0]->billingAddress->street1);
     $this->assertEquals('street22', $accounts[0]->billingAddress->street2);
     $this->assertEquals('b@b.com', $accounts[0]->primaryEmail->emailAddress);
     $this->assertEquals('1', $accounts[0]->primaryEmail->isInvalid);
     $this->assertEquals('1', $accounts[0]->primaryEmail->optOut);
     $this->assertTrue($accounts[0]->account->isSame($parentAccount));
     $this->assertEquals('Banking', $accounts[0]->industry->value);
     $this->assertEquals('Customer', $accounts[0]->type->value);
     $accounts = Account::getByName('account3');
     $this->assertEquals(1, count($accounts[0]));
     $this->assertEquals(323456, $accounts[0]->officePhone);
     $this->assertEquals(777, $accounts[0]->officeFax);
     $this->assertEquals(3, $accounts[0]->employees);
     $this->assertEquals('http://www.account3.com', $accounts[0]->website);
     $this->assertEquals(300, $accounts[0]->annualRevenue);
     $this->assertEquals('desc3', $accounts[0]->description);
     $this->assertEquals('city3', $accounts[0]->billingAddress->city);
     $this->assertEquals('country3', $accounts[0]->billingAddress->country);
     $this->assertEquals('postal3', $accounts[0]->billingAddress->postalCode);
     $this->assertEquals('state3', $accounts[0]->billingAddress->state);
     $this->assertEquals('street13', $accounts[0]->billingAddress->street1);
     $this->assertEquals('street23', $accounts[0]->billingAddress->street2);
     $this->assertEquals('c@c.com', $accounts[0]->primaryEmail->emailAddress);
     $this->assertEquals(null, $accounts[0]->primaryEmail->isInvalid);
     $this->assertEquals(null, $accounts[0]->primaryEmail->optOut);
     $this->assertTrue($accounts[0]->account->isSame($parentAccount));
     $this->assertEquals('Energy', $accounts[0]->industry->value);
     $this->assertEquals('Vendor', $accounts[0]->type->value);
     //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));
//.........这里部分代码省略.........
开发者ID:youprofit,项目名称:Zurmo,代码行数:101,代码来源:AccountImportTest.php


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