Mercurial > hg > isophonics-drupal-site
diff core/modules/config/tests/src/Functional/ConfigEntityTest.php @ 12:7a779792577d
Update Drupal core to v8.4.5 (via Composer)
author | Chris Cannam |
---|---|
date | Fri, 23 Feb 2018 15:52:07 +0000 |
parents | 4c8ae668cc8c |
children | 129ea1e6d783 |
line wrap: on
line diff
--- a/core/modules/config/tests/src/Functional/ConfigEntityTest.php Fri Feb 23 15:51:18 2018 +0000 +++ b/core/modules/config/tests/src/Functional/ConfigEntityTest.php Fri Feb 23 15:52:07 2018 +0000 @@ -35,7 +35,8 @@ public function testCRUD() { $default_langcode = \Drupal::languageManager()->getDefaultLanguage()->getId(); // Verify default properties on a newly created empty entity. - $empty = entity_create('config_test'); + $storage = \Drupal::entityTypeManager()->getStorage('config_test'); + $empty = $storage->create(); $this->assertTrue($empty->uuid()); $this->assertIdentical($empty->label, NULL); $this->assertIdentical($empty->style, NULL); @@ -76,7 +77,7 @@ } // Verify that an entity with an empty ID string is considered empty, too. - $empty_id = entity_create('config_test', [ + $empty_id = $storage->create([ 'id' => '', ]); $this->assertIdentical($empty_id->isNew(), TRUE); @@ -89,7 +90,7 @@ } // Verify properties on a newly created entity. - $config_test = entity_create('config_test', $expected = [ + $config_test = $storage->create($expected = [ 'id' => $this->randomMachineName(), 'label' => $this->randomString(), 'style' => $this->randomMachineName(), @@ -141,7 +142,7 @@ // maximum allowed length, but not longer. // Test with a short ID. - $id_length_config_test = entity_create('config_test', [ + $id_length_config_test = $storage->create([ 'id' => $this->randomMachineName(8), ]); try { @@ -155,7 +156,7 @@ } // Test with an ID of the maximum allowed length. - $id_length_config_test = entity_create('config_test', [ + $id_length_config_test = $storage->create([ 'id' => $this->randomMachineName(static::MAX_ID_LENGTH), ]); try { @@ -169,7 +170,7 @@ } // Test with an ID exceeding the maximum allowed length. - $id_length_config_test = entity_create('config_test', [ + $id_length_config_test = $storage->create([ 'id' => $this->randomMachineName(static::MAX_ID_LENGTH + 1), ]); try { @@ -188,7 +189,7 @@ // Ensure that creating an entity with the same id as an existing one is not // possible. - $same_id = entity_create('config_test', [ + $same_id = $storage->create([ 'id' => $config_test->id(), ]); $this->assertIdentical($same_id->isNew(), TRUE); @@ -223,7 +224,7 @@ // Test config entity prepopulation. \Drupal::state()->set('config_test.prepopulate', TRUE); - $config_test = entity_create('config_test', ['foo' => 'bar']); + $config_test = $storage->create(['foo' => 'bar']); $this->assertEqual($config_test->get('foo'), 'baz', 'Initial value correctly populated'); }