class EntityRepositoryTest in Drupal 9
Same name in this branch
- 9 core/tests/Drupal/Tests/Core/Entity/EntityRepositoryTest.php \Drupal\Tests\Core\Entity\EntityRepositoryTest
- 9 core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest
Same name and namespace in other branches
- 8 core/tests/Drupal/KernelTests/Core/Entity/EntityRepositoryTest.php \Drupal\KernelTests\Core\Entity\EntityRepositoryTest
Tests the entity repository.
@group Entity
@coversDefaultClass \Drupal\Core\Entity\EntityRepository
Hierarchy
- class \Drupal\KernelTests\KernelTestBase extends \PHPUnit\Framework\TestCase implements ServiceProviderInterface uses \Symfony\Bridge\PhpUnit\ExpectDeprecationTrait, AssertContentTrait, AssertLegacyTrait, ConfigTestTrait, ExtensionListTestTrait, PhpUnitCompatibilityTrait, RandomGeneratorTrait, TestRequirementsTrait, PhpUnitWarnings
- class \Drupal\KernelTests\Core\Entity\EntityRepositoryTest uses UserCreationTrait
Expanded class hierarchy of EntityRepositoryTest
File
- core/
tests/ Drupal/ KernelTests/ Core/ Entity/ EntityRepositoryTest.php, line 20
Namespace
Drupal\KernelTests\Core\EntityView source
class EntityRepositoryTest extends KernelTestBase {
use UserCreationTrait;
/**
* {@inheritdoc}
*/
protected static $modules = [
'entity_test',
'user',
'language',
'system',
];
/**
* The entity type manager.
*
* @var \Drupal\Core\Entity\EntityTypeManagerInterface
*/
protected $entityTypeManager;
/**
* The entity repository.
*
* @var \Drupal\Core\Entity\EntityRepositoryInterface
*/
protected $entityRepository;
/**
* {@inheritdoc}
*/
public function setUp() : void {
parent::setUp();
$this->entityTypeManager = $this->container
->get('entity_type.manager');
$this->entityRepository = $this->container
->get('entity.repository');
$this
->setUpCurrentUser();
$this
->installEntitySchema('entity_test');
$this
->installEntitySchema('entity_test_rev');
$this
->installEntitySchema('entity_test_mul');
$this
->installEntitySchema('entity_test_mulrev');
$this
->installConfig([
'system',
'language',
]);
ConfigurableLanguage::createFromLangcode('it')
->setWeight(1)
->save();
ConfigurableLanguage::createFromLangcode('ro')
->setWeight(2)
->save();
$this->container
->get('state')
->set('entity_test.translation', TRUE);
$this->container
->get('entity_type.bundle.info')
->clearCachedBundles();
}
/**
* Tests retrieving active variants.
*
* @covers ::getActive
* @covers ::getActiveMultiple
*/
public function testGetActive() {
$en_contexts = $this
->getLanguageContexts('en');
// Check that when the entity does not exist NULL is returned.
$entity_type_id = 'entity_test';
$active = $this->entityRepository
->getActive($entity_type_id, -1);
$this
->assertNull($active);
// Check that the correct active variant is returned for a non-translatable,
// non-revisionable entity.
/** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
$values = [
'name' => $this
->randomString(),
];
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $storage
->create($values);
$storage
->save($entity);
$entity = $storage
->load($entity
->id());
/** @var \Drupal\Core\Entity\ContentEntityInterface $active */
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $en_contexts);
$this
->assertSame($entity, $active);
// Check that the correct active variant is returned for a non-translatable
// revisionable entity.
$entity_type_id = 'entity_test_rev';
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
$values = [
'name' => $this
->randomString(),
];
$entity = $storage
->create($values);
$storage
->save($entity);
/** @var \Drupal\Core\Entity\ContentEntityInterface $revision */
$revision = $storage
->createRevision($entity, FALSE);
$revision
->save();
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $en_contexts);
$this
->assertEntityType($active, $entity_type_id);
$this
->assertSame($revision
->getLoadedRevisionId(), $active
->getLoadedRevisionId());
/** @var \Drupal\Core\Entity\ContentEntityInterface $revision2 */
$revision2 = $storage
->createRevision($revision);
$revision2
->save();
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $en_contexts);
$this
->assertSame($revision2
->getLoadedRevisionId(), $active
->getLoadedRevisionId());
// Check that the correct active variant is returned for a translatable
// non-revisionable entity.
$entity_type_id = 'entity_test_mul';
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
$values = [
'name' => $this
->randomString(),
];
$entity = $storage
->create($values);
$storage
->save($entity);
$langcode = 'it';
/** @var \Drupal\Core\Entity\ContentEntityInterface $translation */
$translation = $entity
->addTranslation($langcode, $values);
$storage
->save($translation);
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $en_contexts);
$this
->assertEntityType($active, $entity_type_id);
$this
->assertSame($entity
->language()
->getId(), $active
->language()
->getId());
$it_contexts = $this
->getLanguageContexts($langcode);
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $it_contexts);
$this
->assertSame($translation
->language()
->getId(), $active
->language()
->getId());
// Check that the correct active variant is returned for a translatable and
// revisionable entity.
$entity_type_id = 'entity_test_mulrev';
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
$values = [
'name' => $this
->randomString(),
];
$entity = $storage
->create($values);
$storage
->save($entity);
/** @var \Drupal\Core\Entity\ContentEntityInterface $en_revision */
$en_revision = $storage
->createRevision($entity, FALSE);
$storage
->save($en_revision);
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $en_contexts);
$this
->assertEntityType($active, $entity_type_id);
$this
->assertSame($en_revision
->getLoadedRevisionId(), $active
->getLoadedRevisionId());
$revision_translation = $en_revision
->addTranslation($langcode, $values);
/** @var \Drupal\Core\Entity\ContentEntityInterface $it_revision */
$it_revision = $storage
->createRevision($revision_translation, FALSE);
$storage
->save($it_revision);
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $en_contexts);
$this
->assertSame($en_revision
->getLoadedRevisionId(), $active
->getLoadedRevisionId());
$this
->assertSame($en_revision
->language()
->getId(), $active
->language()
->getId());
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $it_contexts);
$this
->assertSame($it_revision
->getLoadedRevisionId(), $active
->getLoadedRevisionId());
$this
->assertSame($it_revision
->language()
->getId(), $active
->language()
->getId());
/** @var \Drupal\Core\Entity\ContentEntityInterface $en_revision2 */
$en_revision2 = $storage
->createRevision($en_revision);
$storage
->save($en_revision2);
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $en_contexts);
$this
->assertSame($en_revision2
->getLoadedRevisionId(), $active
->getLoadedRevisionId());
$this
->assertSame($en_revision2
->language()
->getId(), $active
->language()
->getId());
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $it_contexts);
$this
->assertSame($it_revision
->getLoadedRevisionId(), $active
->getLoadedRevisionId());
$this
->assertSame($it_revision
->language()
->getId(), $active
->language()
->getId());
/** @var \Drupal\Core\Entity\ContentEntityInterface $it_revision2 */
$it_revision2 = $storage
->createRevision($it_revision);
$storage
->save($it_revision2);
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $en_contexts);
$this
->assertSame($it_revision2
->getLoadedRevisionId(), $active
->getLoadedRevisionId());
$this
->assertSame($it_revision2
->getUntranslated()
->language()
->getId(), $active
->language()
->getId());
$active = $this->entityRepository
->getActive($entity_type_id, $entity
->id(), $it_contexts);
$this
->assertSame($it_revision2
->getLoadedRevisionId(), $active
->getLoadedRevisionId());
$this
->assertSame($it_revision2
->language()
->getId(), $active
->language()
->getId());
/** @var \Drupal\entity_test\Entity\EntityTestMulRev $entity2 */
$entity2 = $storage
->create($values);
$storage
->save($entity2);
/** @var \Drupal\Core\Entity\ContentEntityInterface[] $active */
$active = $this->entityRepository
->getActiveMultiple($entity_type_id, [
$entity
->id(),
$entity2
->id(),
], $it_contexts);
$this
->assertSame($it_revision2
->getLoadedRevisionId(), $active[$entity
->id()]
->getLoadedRevisionId());
$this
->assertSame($it_revision2
->language()
->getId(), $active[$entity
->id()]
->language()
->getId());
$this
->assertSame($entity2
->getLoadedRevisionId(), $active[$entity2
->id()]
->getLoadedRevisionId());
$this
->assertSame($entity2
->language()
->getId(), $active[$entity2
->id()]
->language()
->getId());
$this
->doTestLanguageFallback('getActive');
}
/**
* Tests retrieving canonical variants.
*
* @covers ::getCanonical
* @covers ::getCanonicalMultiple
*/
public function testGetCanonical() {
// Check that when the entity does not exist NULL is returned.
$entity_type_id = 'entity_test_mul';
$canonical = $this->entityRepository
->getActive($entity_type_id, -1);
$this
->assertNull($canonical);
// Check that the correct language fallback rules are applied.
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
$values = [
'name' => $this
->randomString(),
];
/** @var \Drupal\Core\Entity\ContentEntityInterface $entity */
$entity = $storage
->create($values);
$storage
->save($entity);
$langcode = 'it';
$it_contexts = $this
->getLanguageContexts($langcode);
$canonical = $this->entityRepository
->getCanonical($entity_type_id, $entity
->id(), $it_contexts);
$this
->assertSame($entity
->getUntranslated()
->language()
->getId(), $canonical
->language()
->getId());
/** @var \Drupal\Core\Entity\ContentEntityInterface $translation */
$translation = $entity
->addTranslation($langcode, $values);
$storage
->save($translation);
$canonical = $this->entityRepository
->getCanonical($entity_type_id, $entity
->id(), $it_contexts);
$this
->assertSame($translation
->language()
->getId(), $canonical
->language()
->getId());
$canonical = $this->entityRepository
->getCanonical($entity_type_id, $entity
->id());
$this
->assertSame($entity
->getUntranslated()
->language()
->getId(), $canonical
->language()
->getId());
/** @var \Drupal\entity_test\Entity\EntityTestMul $entity2 */
$entity2 = $storage
->create($values);
$storage
->save($entity2);
/** @var \Drupal\Core\Entity\ContentEntityInterface[] $canonical */
$canonical = $this->entityRepository
->getCanonicalMultiple($entity_type_id, [
$entity
->id(),
$entity2
->id(),
], $it_contexts);
$this
->assertSame($translation
->language()
->getId(), $canonical[$entity
->id()]
->language()
->getId());
$this
->assertSame($entity2
->language()
->getId(), $canonical[$entity2
->id()]
->language()
->getId());
$this
->doTestLanguageFallback('getCanonical');
}
/**
* Check that language fallback is applied.
*
* @param string $method_name
* An entity repository method name.
*/
protected function doTestLanguageFallback($method_name) {
$entity_type_id = 'entity_test_mulrev';
$en_contexts = $this
->getLanguageContexts('en');
$it_contexts = $this
->getLanguageContexts('it');
$ro_contexts = $this
->getLanguageContexts('ro');
/** @var \Drupal\Core\Entity\ContentEntityStorageInterface $storage */
$storage = $this->entityTypeManager
->getStorage($entity_type_id);
$values = [
'name' => $this
->randomString(),
];
/** @var \Drupal\entity_test\Entity\EntityTestMulRev $entity3 */
$entity3 = $storage
->create([
'langcode' => 'it',
] + $values);
$entity3
->addTranslation('ro', $values);
$storage
->save($entity3);
/** @var \Drupal\entity_test\Entity\EntityTestMulRev $active */
$active = $this->entityRepository
->{$method_name}($entity_type_id, $entity3
->id(), $en_contexts);
$this
->assertSame('it', $active
->language()
->getId());
$active = $this->entityRepository
->{$method_name}($entity_type_id, $entity3
->id(), $ro_contexts);
$this
->assertSame('ro', $active
->language()
->getId());
/** @var \Drupal\entity_test\Entity\EntityTestMulRev $entity4 */
$entity4 = $storage
->create([
'langcode' => 'ro',
] + $values);
$entity4
->addTranslation('en', $values);
$storage
->save($entity4);
$active = $this->entityRepository
->{$method_name}($entity_type_id, $entity4
->id(), $it_contexts);
$this
->assertSame('en', $active
->language()
->getId());
/** @var \Drupal\entity_test\Entity\EntityTestMulRev $entity5 */
$entity5 = $storage
->create([
'langcode' => 'ro',
] + $values);
$storage
->save($entity5);
$active = $this->entityRepository
->{$method_name}($entity_type_id, $entity5
->id(), $it_contexts);
$this
->assertSame('ro', $active
->language()
->getId());
$active = $this->entityRepository
->{$method_name}($entity_type_id, $entity5
->id(), $en_contexts);
$this
->assertSame('ro', $active
->language()
->getId());
}
/**
* Asserts that the entity has the expected entity type ID.
*
* @param object|null $entity
* An entity object or NULL.
* @param string $expected_entity_type_id
* The expected entity type ID.
*/
protected function assertEntityType($entity, $expected_entity_type_id) {
$this
->assertInstanceOf(EntityTest::class, $entity);
$this
->assertEquals($expected_entity_type_id, $entity
->getEntityTypeId());
}
/**
* Returns a set of language contexts matching the specified language.
*
* @param string $langcode
* A language code.
*
* @return \Drupal\Core\Plugin\Context\ContextInterface[]
* An array of contexts.
*/
protected function getLanguageContexts($langcode) {
$prefix = '@language.current_language_context:';
return [
$prefix . LanguageInterface::TYPE_INTERFACE => new Context(new ContextDefinition('language'), $langcode),
$prefix . LanguageInterface::TYPE_CONTENT => new Context(new ContextDefinition('language'), $langcode),
];
}
}
Members
Name | Modifiers | Type | Description | Overrides |
---|---|---|---|---|
AssertContentTrait:: |
protected | property | The current raw content. | |
AssertContentTrait:: |
protected | property | The drupalSettings value from the current raw $content. | |
AssertContentTrait:: |
protected | property | The XML structure parsed from the current raw $content. | 1 |
AssertContentTrait:: |
protected | property | The plain-text content of raw $content (text nodes). | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page by the given XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a field exists in the current page with a given Xpath result. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is found. | |
AssertContentTrait:: |
protected | function | Asserts that each HTML ID is used for just a single element. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS NOT found escaped on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name or ID. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given ID and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist with the given name and value. | |
AssertContentTrait:: |
protected | function | Asserts that a field does not exist or its value does not match, by XPath. | |
AssertContentTrait:: |
protected | function | Asserts that a checkbox field in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Passes if a link with the specified label is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href (part) is not found. | |
AssertContentTrait:: |
protected | function | Passes if a link containing a given href is not found in the main region. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page does not exist. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is not checked. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the perl regex pattern is not found in raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text is NOT found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) does not contains the text. | |
AssertContentTrait:: |
protected | function | Pass if the page title is not the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found MORE THAN ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option with the visible text exists. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page is checked. | |
AssertContentTrait:: |
protected | function | Asserts that a select option in the current page exists. | |
AssertContentTrait:: |
protected | function | Triggers a pass if the Perl regex pattern is found in the raw content. | |
AssertContentTrait:: |
protected | function | Passes if the raw text IS found on the loaded page, fail otherwise. | |
AssertContentTrait:: |
protected | function | Passes if the page (with HTML stripped) contains the text. | |
AssertContentTrait:: |
protected | function | Helper for assertText and assertNoText. | |
AssertContentTrait:: |
protected | function | Asserts that a Perl regex pattern is found in the plain-text content. | |
AssertContentTrait:: |
protected | function | Asserts themed output. | |
AssertContentTrait:: |
protected | function | Pass if the page title is the given string. | |
AssertContentTrait:: |
protected | function | Passes if the text is found ONLY ONCE on the text version of the page. | |
AssertContentTrait:: |
protected | function | Helper for assertUniqueText and assertNoUniqueText. | |
AssertContentTrait:: |
protected | function | Builds an XPath query. | |
AssertContentTrait:: |
protected | function | Helper: Constructs an XPath for the given set of attributes and value. | |
AssertContentTrait:: |
protected | function | Searches elements using a CSS selector in the raw content. | |
AssertContentTrait:: |
protected | function | Get all option elements, including nested options, in a select. | |
AssertContentTrait:: |
protected | function | Gets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Gets the current raw content. | |
AssertContentTrait:: |
protected | function | Get the selected value from a select field. | |
AssertContentTrait:: |
protected | function | Retrieves the plain-text content from the current raw content. | |
AssertContentTrait:: |
protected | function | Get the current URL from the cURL handler. | 1 |
AssertContentTrait:: |
protected | function | Parse content returned from curlExec using DOM and SimpleXML. | |
AssertContentTrait:: |
protected | function | Removes all white-space between HTML tags from the raw content. | |
AssertContentTrait:: |
protected | function | Sets the value of drupalSettings for the currently-loaded page. | |
AssertContentTrait:: |
protected | function | Sets the raw content (e.g. HTML). | |
AssertContentTrait:: |
protected | function | Performs an xpath search on the contents of the internal browser. | |
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
AssertLegacyTrait:: |
protected | function | ||
ConfigTestTrait:: |
protected | function | Returns a ConfigImporter object to import test configuration. | |
ConfigTestTrait:: |
protected | function | Copies configuration objects from source storage to target storage. | |
EntityRepositoryTest:: |
protected | property | The entity repository. | |
EntityRepositoryTest:: |
protected | property | The entity type manager. | |
EntityRepositoryTest:: |
protected static | property |
Modules to enable. Overrides KernelTestBase:: |
|
EntityRepositoryTest:: |
protected | function | Asserts that the entity has the expected entity type ID. | |
EntityRepositoryTest:: |
protected | function | Check that language fallback is applied. | |
EntityRepositoryTest:: |
protected | function | Returns a set of language contexts matching the specified language. | |
EntityRepositoryTest:: |
public | function |
Overrides KernelTestBase:: |
|
EntityRepositoryTest:: |
public | function | Tests retrieving active variants. | |
EntityRepositoryTest:: |
public | function | Tests retrieving canonical variants. | |
ExtensionListTestTrait:: |
protected | function | Gets the path for the specified module. | |
ExtensionListTestTrait:: |
protected | function | Gets the path for the specified theme. | |
KernelTestBase:: |
protected | property | Back up and restore any global variables that may be changed by tests. | |
KernelTestBase:: |
protected | property | Back up and restore static class properties that may be changed by tests. | |
KernelTestBase:: |
protected | property | Contains a few static class properties for performance. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | @todo Move into Config test base class. | 7 |
KernelTestBase:: |
protected static | property | An array of config object names that are excluded from schema checking. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Do not forward any global state from the parent process to the processes that run the actual tests. | |
KernelTestBase:: |
protected | property | The app root. | |
KernelTestBase:: |
protected | property | Kernel tests are run in separate processes because they allow autoloading of code from extensions. Running the test in a separate process isolates this behavior from other tests. Subclasses should not override this property. | |
KernelTestBase:: |
protected | property | ||
KernelTestBase:: |
protected | property | Set to TRUE to strict check all configuration saved. | 6 |
KernelTestBase:: |
protected | property | The virtual filesystem root directory. | |
KernelTestBase:: |
protected | function | 1 | |
KernelTestBase:: |
protected | function | Bootstraps a basic test environment. | |
KernelTestBase:: |
private | function | Bootstraps a kernel for a test. | |
KernelTestBase:: |
protected | function | Configuration accessor for tests. Returns non-overridden configuration. | |
KernelTestBase:: |
protected | function | Disables modules for this test. | |
KernelTestBase:: |
protected | function | Enables modules for this test. | |
KernelTestBase:: |
protected | function | Gets the config schema exclusions for this test. | |
KernelTestBase:: |
protected | function | Returns the Database connection info to be used for this test. | 3 |
KernelTestBase:: |
public | function | ||
KernelTestBase:: |
private | function | Returns Extension objects for $modules to enable. | |
KernelTestBase:: |
private static | function | Returns the modules to enable for this test. | |
KernelTestBase:: |
protected | function | Initializes the FileCache component. | |
KernelTestBase:: |
protected | function | Installs default configuration for a given list of modules. | |
KernelTestBase:: |
protected | function | Installs the storage schema for a specific entity type. | |
KernelTestBase:: |
protected | function | Installs database tables from a module schema definition. | |
KernelTestBase:: |
protected | function | ||
KernelTestBase:: |
public | function |
Registers test-specific services. Overrides ServiceProviderInterface:: |
24 |
KernelTestBase:: |
protected | function | Renders a render array. | 1 |
KernelTestBase:: |
protected | function | Sets the install profile and rebuilds the container to update it. | |
KernelTestBase:: |
protected | function | Sets an in-memory Settings variable. | |
KernelTestBase:: |
public static | function | 1 | |
KernelTestBase:: |
protected | function | Sets up the filesystem, so things like the file directory. | 2 |
KernelTestBase:: |
protected | function | Stops test execution. | |
KernelTestBase:: |
protected | function | 4 | |
KernelTestBase:: |
public | function | @after | |
KernelTestBase:: |
protected | function | Dumps the current state of the virtual filesystem to STDOUT. | |
KernelTestBase:: |
public | function | Prevents serializing any properties. | |
PhpUnitWarnings:: |
private static | property | Deprecation warnings from PHPUnit to raise with @trigger_error(). | |
PhpUnitWarnings:: |
public | function | Converts PHPUnit deprecation warnings to E_USER_DEPRECATED. | |
RandomGeneratorTrait:: |
protected | property | The random generator. | |
RandomGeneratorTrait:: |
protected | function | Gets the random generator for the utility methods. | |
RandomGeneratorTrait:: |
protected | function | Generates a unique random string containing letters and numbers. | 1 |
RandomGeneratorTrait:: |
public | function | Generates a random PHP object. | |
RandomGeneratorTrait:: |
public | function | Generates a pseudo-random string of ASCII characters of codes 32 to 126. | |
RandomGeneratorTrait:: |
public | function | Callback for random string validation. | |
StorageCopyTrait:: |
protected static | function | Copy the configuration from one storage to another and remove stale items. | |
TestRequirementsTrait:: |
private | function | Checks missing module requirements. | |
TestRequirementsTrait:: |
protected | function | Check module requirements for the Drupal use case. | 1 |
TestRequirementsTrait:: |
protected static | function | Returns the Drupal root directory. | |
UserCreationTrait:: |
protected | function | Checks whether a given list of permission names is valid. | |
UserCreationTrait:: |
protected | function | Creates an administrative role. | |
UserCreationTrait:: |
protected | function | Creates a role with specified permissions. | |
UserCreationTrait:: |
protected | function | Create a user with a given set of permissions. | |
UserCreationTrait:: |
protected | function | Grant permissions to a user role. | |
UserCreationTrait:: |
protected | function | Switch the current logged in user. | |
UserCreationTrait:: |
protected | function | Creates a random user account and sets it as current user. |