Issue #1843462 by ACF, aspilicious: Change entity_test() variables - entity_test_translation(), entity_cache_test() and entity_cache_test_label() to the state system.
parent
477c52fad8
commit
b169181225
|
@ -32,7 +32,7 @@ class EntityApiInfoTest extends WebTestBase {
|
|||
|
||||
// Change the label of the test entity type and make sure changes appear
|
||||
// after flushing caches.
|
||||
variable_set('entity_cache_test_label', 'New label.');
|
||||
state()->set('entity_cache_test.label', 'New label.');
|
||||
$info = entity_get_info('entity_cache_test');
|
||||
$this->assertEqual($info['label'], 'Entity Cache Test', 'Original label appears in cached entity info.');
|
||||
$this->resetAll();
|
||||
|
@ -52,7 +52,7 @@ class EntityApiInfoTest extends WebTestBase {
|
|||
*/
|
||||
function testEntityInfoCacheWatchdog() {
|
||||
module_enable(array('entity_cache_test'));
|
||||
$info = variable_get('entity_cache_test');
|
||||
$info = state()->get('entity_cache_test');
|
||||
$this->assertEqual($info['label'], 'Entity Cache Test', 'Entity info label is correct.');
|
||||
$this->assertEqual($info['controller_class'], 'Drupal\Core\Entity\DatabaseStorageController', 'Entity controller class info is correct.');
|
||||
}
|
||||
|
|
|
@ -37,7 +37,7 @@ class EntityTranslationFormTest extends WebTestBase {
|
|||
function setUp() {
|
||||
parent::setUp();
|
||||
// Enable translations for the test entity type.
|
||||
variable_set('entity_test_translation', TRUE);
|
||||
state()->set('entity_test.translation', TRUE);
|
||||
|
||||
// Create test languages.
|
||||
$this->langcodes = array();
|
||||
|
|
|
@ -37,7 +37,7 @@ class EntityTranslationTest extends WebTestBase {
|
|||
function setUp() {
|
||||
parent::setUp();
|
||||
// Enable translations for the test entity type.
|
||||
variable_set('entity_test_translation', TRUE);
|
||||
state()->set('entity_test.translation', TRUE);
|
||||
|
||||
// Create a translatable test field.
|
||||
$this->field_name = drupal_strtolower($this->randomName() . '_field_name');
|
||||
|
|
|
@ -22,6 +22,6 @@ function entity_cache_test_watchdog($log_entry) {
|
|||
$info = entity_get_info('entity_cache_test');
|
||||
// Store the information in a system variable to analyze it later in the
|
||||
// test case.
|
||||
variable_set('entity_cache_test', $info);
|
||||
state()->set('entity_cache_test', $info);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -9,5 +9,5 @@
|
|||
* Implements hook_entity_info_alter().
|
||||
*/
|
||||
function entity_cache_test_dependency_entity_info_alter(&$info) {
|
||||
$info['entity_cache_test']['label'] = variable_get('entity_cache_test_label', 'Entity Cache Test');
|
||||
$info['entity_cache_test']['label'] = state()->get('entity_cache_test.label') ?: 'Entity Cache Test';
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@ use Drupal\entity_test\Plugin\Core\Entity\EntityTest;
|
|||
*/
|
||||
function entity_test_entity_info_alter(&$info) {
|
||||
// Optionally specify a translation handler for testing translations.
|
||||
if (variable_get('entity_test_translation')) {
|
||||
if (state()->get('entity_test.translation')) {
|
||||
$info['entity_test']['translation']['entity_test'] = TRUE;
|
||||
}
|
||||
// Optionally unset the access controller to test the fallback.
|
||||
|
|
Loading…
Reference in New Issue