|
@@ 130-138 (lines=9) @@
|
| 127 |
|
* Test referencing a role by label. |
| 128 |
|
* Roles have string id's so can be referenced by label or id. |
| 129 |
|
*/ |
| 130 |
|
public function testRoleReferenceByLabel() |
| 131 |
|
{ |
| 132 |
|
$this->installEntitySchema('user_role'); |
| 133 |
|
$role = Role::create(['id' => 'test_role', 'label' => 'Test role label'])->save(); |
| 134 |
|
$this->fieldStorageSettings = ['target_type' => 'user_role']; |
| 135 |
|
$field = ['Test role label']; |
| 136 |
|
$fieldExpected = [['target_id' => 'test_role']]; |
| 137 |
|
$this->assertCreatedWithField($field, $fieldExpected); |
| 138 |
|
} |
| 139 |
|
|
| 140 |
|
/** |
| 141 |
|
* Test referencing a role by id. |
|
@@ 144-152 (lines=9) @@
|
| 141 |
|
* Test referencing a role by id. |
| 142 |
|
* Roles have string id's so can be referenced by label or id. |
| 143 |
|
*/ |
| 144 |
|
public function testRoleReferenceById() |
| 145 |
|
{ |
| 146 |
|
$this->installEntitySchema('user_role'); |
| 147 |
|
$role = Role::create(['id' => 'test_role', 'label' => 'Test role label'])->save(); |
| 148 |
|
$this->fieldStorageSettings = ['target_type' => 'user_role']; |
| 149 |
|
$field = ['test_role']; |
| 150 |
|
$fieldExpected = [['target_id' => 'test_role']]; |
| 151 |
|
$this->assertCreatedWithField($field, $fieldExpected); |
| 152 |
|
} |
| 153 |
|
|
| 154 |
|
/** |
| 155 |
|
* Test referencing a role by id without underscores. |
|
@@ 158-166 (lines=9) @@
|
| 155 |
|
* Test referencing a role by id without underscores. |
| 156 |
|
* Roles have string id's so can be referenced by label or id. |
| 157 |
|
*/ |
| 158 |
|
public function testRoleReferenceByIdWithoutUnderscores() |
| 159 |
|
{ |
| 160 |
|
$this->installEntitySchema('user_role'); |
| 161 |
|
$role = Role::create(['id' => 'test_role', 'label' => 'Test role label'])->save(); |
| 162 |
|
$this->fieldStorageSettings = ['target_type' => 'user_role']; |
| 163 |
|
$field = ['test role']; |
| 164 |
|
$fieldExpected = [['target_id' => 'test_role']]; |
| 165 |
|
$this->assertCreatedWithField($field, $fieldExpected); |
| 166 |
|
} |
| 167 |
|
|
| 168 |
|
/** |
| 169 |
|
* Test referencing a role by id case insensitively. |