本文整理匯總了PHP中SecurityTestHelper::createAccounts方法的典型用法代碼示例。如果您正苦於以下問題:PHP SecurityTestHelper::createAccounts方法的具體用法?PHP SecurityTestHelper::createAccounts怎麽用?PHP SecurityTestHelper::createAccounts使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類SecurityTestHelper
的用法示例。
在下文中一共展示了SecurityTestHelper::createAccounts方法的4個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
ZurmoDatabaseCompatibilityUtil::dropStoredFunctionsAndProcedures();
SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
SecurityTestHelper::createUsers();
SecurityTestHelper::createGroups();
SecurityTestHelper::createAccounts();
}
示例2: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
SecurityTestHelper::createUsers();
SecurityTestHelper::createGroups();
SecurityTestHelper::createAccounts();
SecurityTestHelper::createRoles();
$everyone = Group::getByName('Everyone');
$saved = $everyone->save();
assert('$saved');
// Not Coding Standard
ReadPermissionsOptimizationUtil::rebuild();
}
示例3: setUpBeforeClass
public static function setUpBeforeClass()
{
parent::setUpBeforeClass();
SecurityTestHelper::createSuperAdmin();
Yii::app()->user->userModel = User::getByUsername('super');
SecurityTestHelper::createUsers();
SecurityTestHelper::createGroups();
SecurityTestHelper::createAccounts();
SecurityTestHelper::createRoles();
$everyone = Group::getByName('Everyone');
$saved = $everyone->save();
assert('$saved');
// Not Coding Standard
//Add contacts to help test that the rebuild is working correctly
$contact = ContactTestHelper::createContactByNameForOwner('jason', Yii::app()->user->userModel);
$contact->addPermissions(User::getByUsername('betty'), Permission::READ);
$contact->addPermissions(Group::getByName('Support Staff'), Permission::READ);
$saved = $contact->save();
assert('$saved');
// Not Coding Standard
ReadPermissionsOptimizationUtil::rebuild();
assert('self::getAccountMungeRowCount() == 0');
// Not Coding Standard
}
示例4: testSecurityExceptionThrownDuringExport
public function testSecurityExceptionThrownDuringExport()
{
$super = User::getByUsername('super');
Yii::app()->user->userModel = $super;
SecurityTestHelper::createAccounts();
$billy = User::getByUsername('billy');
Yii::app()->user->userModel = $billy;
AllPermissionsOptimizationUtil::rebuild();
$numberOfUserNotifications = Notification::getCountByTypeAndUser('ExportProcessCompleted', $billy);
$account = new Account(false);
$searchForm = new AccountsSearchForm($account);
$dataProvider = ExportTestHelper::makeRedBeanDataProvider($searchForm, 'Account', 0, $billy->id);
$totalItems = $dataProvider->getTotalItemCount();
$this->assertEquals(3, $totalItems);
$exportItem = new ExportItem();
$exportItem->isCompleted = 0;
$exportItem->exportFileType = 'csv';
$exportItem->exportFileName = 'test7';
$exportItem->modelClassName = 'Account';
$exportItem->serializedData = serialize($dataProvider);
$exportItem->owner = $billy;
$this->assertTrue($exportItem->save());
$id = $exportItem->id;
$exportItem->forget();
unset($exportItem);
//Delete queued jobs from test exportItems created above
Yii::app()->jobQueue->deleteAll();
$accounts = Account::getByName('Microsoft');
$account = $accounts[0];
$account->owner = $super;
$this->assertTrue($account->save());
$job = new ExportJob();
//ReadPermissionSubscriptionUpdate should get added to jobQueue
$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('csv', $exportItem->exportFileType);
$this->assertEquals('test7', $exportItem->exportFileName);
$this->assertTrue($fileModel instanceof ExportFileModel);
$data = array();
$rows = $dataProvider->getData();
$modelToExportAdapter = new ModelToExportAdapter($rows[0]);
$headerData = $modelToExportAdapter->getHeaderData();
foreach ($rows as $model) {
//billy lost access to Microsoft account
if ($model->id != $account->id) {
$modelToExportAdapter = new ModelToExportAdapter($model);
$data[] = $modelToExportAdapter->getData();
}
}
$output = ExportItemToCsvFileUtil::export($data, $headerData, 'test7.csv', false);
$this->assertEquals($output, $fileModel->fileContent->content);
}