Drupal 8  8.0.2
EntityUnitTestBase Class Reference
Inheritance diagram for EntityUnitTestBase:

Static Public Attributes

static $modules = ['user', 'system', 'field', 'text', 'filter', 'entity_test']
 

Protected Member Functions

 setUp ()
 
 createUser ($values=array(), $permissions=array())
 
 reloadEntity (EntityInterface $entity)
 
 getHooksInfo ()
 
 installModule ($module)
 
 uninstallModule ($module)
 
 refreshServices ()
 
 generateRandomEntityId ($string=FALSE)
 

Protected Attributes

 $entityManager
 
 $generatedIds = array()
 
 $state
 

Detailed Description

Defines an abstract test base for entity unit tests.

Member Function Documentation

createUser (   $values = array(),
  $permissions = array() 
)
protected

Creates a user.

Parameters
array$values(optional) The values used to create the entity.
array$permissions(optional) Array of permission names to assign to user.
Returns
The created user entity.

Referenced by EntityValidationTest\createTestEntity(), EntityFieldTest\createTestEntity(), EntityFieldTest\doTestReadWrite(), NodeFieldOverridesTest\setUp(), NodeFieldAccessTest\testAccessToAdministrativeFields(), CommentFieldAccessTest\testAccessToAdministrativeFields(), EntityCrudHookTest\testCommentHooks(), NodeConditionTest\testConditions(), EntityApiTest\testCRUD(), EntityAccessControlHandlerTest\testDefaultEntityAccess(), EditorFileUsageTest\testEditorEntityHooks(), EntityAccessControlHandlerTest\testEntityAccess(), EntityAccessControlHandlerTest\testEntityAccessDefaultController(), EntityAutocompleteElementFormTest\testEntityAutocompleteAccess(), EntityAccessControlHandlerTest\testEntityTranslationAccess(), ContentEntityCloneTest\testFieldEntityReferenceAfterClone(), MessageEntityTest\testMessageMethods(), EntityRevisionTranslationTest\testNewRevisionAfterTranslation(), EntityCrudHookTest\testNodeHooks(), NodeTokenReplaceTest\testNodeTokenReplacement(), NodeOwnerTest\testOwner(), EntityRevisionTranslationTest\testRevertRevisionAfterTranslation(), FilterAPITest\testTypedDataAPI(), EntityTypeConstraintValidatorTest\testValidation(), NodeValidationTest\testValidation(), and ValidReferenceConstraintValidatorTest\testValidation().

Here is the caller graph for this function:

generateRandomEntityId (   $string = FALSE)
protected

Generates a random ID avoiding collisions.

Parameters
bool$string(optional) Whether the id should have string type. Defaults to FALSE.
Returns
int|string The entity identifier.
getHooksInfo ( )
protected

Returns the entity_test hook invocation info.

Returns
array An associative array of arbitrary hook data keyed by hook name.

References Drupal\state().

Here is the call graph for this function:

installModule (   $module)
protected

Installs a module and refreshes services.

Parameters
string$moduleThe module to install.

References EntityUnitTestBase\refreshServices().

Referenced by EntitySchemaTest\testEntitySchemaUpdate(), and EntitySchemaTest\testModifyingTranslatableColumnSchema().

Here is the call graph for this function:

Here is the caller graph for this function:

refreshServices ( )
protected

Refresh services.

References Drupal\entityManager(), Drupal\getContainer(), and Drupal\state().

Referenced by EntityUnitTestBase\installModule(), and EntityUnitTestBase\uninstallModule().

Here is the call graph for this function:

Here is the caller graph for this function:

reloadEntity ( EntityInterface  $entity)
protected

Reloads the given entity from the storage and returns it.

Parameters
\Drupal\Core\Entity\EntityInterface$entityThe entity to be reloaded.
Returns
The reloaded entity.

References Drupal\entityManager().

Referenced by FieldTranslationSqlStorageTest\testFieldSqlStorage(), EntityRevisionTranslationTest\testNewRevisionAfterTranslation(), and EntityRevisionTranslationTest\testRevertRevisionAfterTranslation().

Here is the call graph for this function:

Here is the caller graph for this function:

uninstallModule (   $module)
protected

Uninstalls a module and refreshes services.

Parameters
string$moduleThe module to uninstall.

References EntityUnitTestBase\refreshServices().

Here is the call graph for this function:


The documentation for this class was generated from the following file: