Exemple #1
0
 /**
  * @construct
  * @param FixtureFactory $fixtureFactory
  * @param array $params
  * @param array $data
  */
 public function __construct(FixtureFactory $fixtureFactory, array $params, array $data = [])
 {
     $this->params = $params;
     if (isset($data['dataSet']) && $data['dataSet'] !== '-') {
         $this->role = $fixtureFactory->createByCode('adminUserRole', ['dataSet' => $data['dataSet']]);
         if (!$this->role->hasData('role_id')) {
             $this->role->persist();
         }
         $this->data = $this->role->getRoleName();
     }
     if (isset($data['role']) && $data['role'] instanceof AdminUserRole) {
         $this->role = $data['role'];
         $this->data = $data['role']->getRoleName();
     }
 }
Exemple #2
0
 /**
  * Asserts that saved role is present in Role Grid.
  *
  * @param UserRoleIndex $rolePage
  * @param AdminUserRole $role
  * @param AdminUserRole $roleInit
  * @return void
  */
 public function processAssert(UserRoleIndex $rolePage, AdminUserRole $role, AdminUserRole $roleInit = null)
 {
     $filter = ['rolename' => $role->hasData('rolename') ? $role->getRoleName() : $roleInit->getRoleName()];
     $rolePage->open();
     \PHPUnit_Framework_Assert::assertTrue($rolePage->getRoleGrid()->isRowVisible($filter), 'Role with name \'' . $filter['rolename'] . '\' is absent in Roles grid.');
 }