本文整理汇总了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);
}