Skip to content
Snippets Groups Projects
Unverified Commit fa1e2888 authored by Lee Rowlands's avatar Lee Rowlands
Browse files

Issue #3240800 by alexpott: Creating an configuration entity via new...

Issue #3240800 by alexpott: Creating an configuration entity via new ConfigEntityClass() triggers deprecations in PHP 8.1, use ConfigEntityClass::create() instead
parent 4b6a3abf
No related branches found
No related tags found
12 merge requests!7452Issue #1797438. HTML5 validation is preventing form submit and not fully...,!1896Issue #2940605: Can only intentionally re-render an entity with references 20 times,!10223132456: Fix issue where views instances are emptied before an ajax request is complete,!872Draft: Issue #3221319: Race condition when creating menu links and editing content deletes menu links,!579Issue #2230909: Simple decimals fail to pass validation,!560Move callback classRemove outside of the loop,!555Issue #3202493,!512Issue #3207771: Menu UI node type form documentation points to non-existent function,!485Sets the autocomplete attribute for username/password input field on login form.,!449Issue #2784233: Allow multiple vocabularies in the taxonomy filter,!231Issue #2671162: summary text wysiwyg patch working fine on 9.2.0-dev,!30Issue #3182188: Updates composer usage to point at ./vendor/bin/composer
......@@ -22,7 +22,7 @@ class LocaleConfigurableLanguageManagerTest extends KernelTestBase {
public function testGetLanguages() {
$this->installSchema('locale', ['locales_source', 'locales_target', 'locales_location']);
$default_language = new ConfigurableLanguage(['label' => $this->randomMachineName(), 'id' => 'default', 'weight' => 0], 'configurable_language');
$default_language = ConfigurableLanguage::create(['label' => $this->randomMachineName(), 'id' => 'default', 'weight' => 0]);
$default_language->save();
// Set new default language.
......@@ -32,7 +32,7 @@ public function testGetLanguages() {
$languages = \Drupal::service('language_manager')->getLanguages(LanguageInterface::STATE_ALL);
$this->assertEquals(['default', 'und', 'zxx'], array_keys($languages));
$configurableLanguage = new ConfigurableLanguage(['label' => $this->randomMachineName(), 'id' => 'test', 'weight' => 1], 'configurable_language');
$configurableLanguage = ConfigurableLanguage::create(['label' => $this->randomMachineName(), 'id' => 'test', 'weight' => 1]);
// Simulate a configuration sync by setting the flag otherwise the locked
// language weights would be updated whilst saving.
// @see \Drupal\language\Entity\ConfigurableLanguage::postSave()
......
......@@ -23,11 +23,11 @@ class ComplexWorkflowTypeTest extends KernelTestBase {
* @covers \Drupal\workflows\Entity\Workflow::loadMultipleByType
*/
public function testLoadMultipleByType() {
$workflow1 = new Workflow(['id' => 'test1', 'type' => 'workflow_type_complex_test'], 'workflow');
$workflow1 = Workflow::create(['id' => 'test1', 'type' => 'workflow_type_complex_test']);
$workflow1->save();
$workflow2 = new Workflow(['id' => 'test2', 'type' => 'workflow_type_complex_test'], 'workflow');
$workflow2 = Workflow::create(['id' => 'test2', 'type' => 'workflow_type_complex_test']);
$workflow2->save();
$workflow3 = new Workflow(['id' => 'test3', 'type' => 'workflow_type_test'], 'workflow');
$workflow3 = Workflow::create(['id' => 'test3', 'type' => 'workflow_type_test']);
$workflow3->save();
$this->assertEquals(['test1', 'test2'], array_keys(Workflow::loadMultipleByType('workflow_type_complex_test')));
......
......@@ -25,10 +25,10 @@ class RequiredStatesTest extends KernelTestBase {
* @covers ::__construct
*/
public function testGetRequiredStates() {
$workflow = new Workflow([
$workflow = Workflow::create([
'id' => 'test',
'type' => 'workflow_type_required_state_test',
], 'workflow');
]);
$workflow->save();
$this->assertEquals(['fresh', 'rotten'], $workflow->getTypePlugin()
->getRequiredStates());
......@@ -43,10 +43,10 @@ public function testGetRequiredStates() {
* @covers \Drupal\workflows\Entity\Workflow::preSave
*/
public function testDeleteRequiredStateAPI() {
$workflow = new Workflow([
$workflow = Workflow::create([
'id' => 'test',
'type' => 'workflow_type_required_state_test',
], 'workflow');
]);
$workflow->save();
// Ensure that required states can't be deleted.
$this->expectException(RequiredStateMissingException::class);
......@@ -59,13 +59,13 @@ public function testDeleteRequiredStateAPI() {
* @covers \Drupal\workflows\Entity\Workflow::preSave
*/
public function testNoStatesRequiredStateAPI() {
$workflow = new Workflow([
$workflow = Workflow::create([
'id' => 'test',
'type' => 'workflow_type_required_state_test',
'type_settings' => [
'states' => [],
],
], 'workflow');
]);
$this->expectException(RequiredStateMissingException::class);
$this->expectExceptionMessage("Required State Type Test' requires states with the ID 'fresh', 'rotten' in workflow 'test'");
$workflow->save();
......@@ -75,10 +75,10 @@ public function testNoStatesRequiredStateAPI() {
* Ensures that initialized configuration can be changed.
*/
public function testChangeRequiredStateAPI() {
$workflow = new Workflow([
$workflow = Workflow::create([
'id' => 'test',
'type' => 'workflow_type_required_state_test',
], 'workflow');
]);
$workflow->save();
// Ensure states added by default configuration can be changed.
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment