From bd8baff067ab1804462d3688288cdf31848d2c75 Mon Sep 17 00:00:00 2001 From: Sergii Pavlenko Date: Wed, 1 Mar 2023 19:34:20 +0200 Subject: [PATCH] EWPP-2570: Update OpenVocabularyTestTrait::createSkosVocabularyAssociation() method. --- .../src/Traits/OpenVocabularyTestTrait.php | 21 +++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/modules/oe_list_pages_open_vocabularies/tests/src/Traits/OpenVocabularyTestTrait.php b/modules/oe_list_pages_open_vocabularies/tests/src/Traits/OpenVocabularyTestTrait.php index f7933451..ab68b63e 100644 --- a/modules/oe_list_pages_open_vocabularies/tests/src/Traits/OpenVocabularyTestTrait.php +++ b/modules/oe_list_pages_open_vocabularies/tests/src/Traits/OpenVocabularyTestTrait.php @@ -56,14 +56,23 @@ public function createTestTaxonomyVocabularyAndTerms(array $term_names, string $ * The field ids for the association. * @param array $concept_schemes * The target concept schemes. + * @param array $names + * Specific skos vocabulary association settings. * * @return \Drupal\open_vocabularies\OpenVocabularyAssociationInterface * The created association. */ - public function createSkosVocabularyAssociation(array $fields, array $concept_schemes = []): OpenVocabularyAssociationInterface { + public function createSkosVocabularyAssociation(array $fields, array $concept_schemes = [], array $names = []): OpenVocabularyAssociationInterface { + $names += [ + 'vocabulary_id' => 'skos_vocabulary', + 'vocabulary_label' => 'My skos vocabulary', + 'association_id' => 'skos_vocabulary', + 'association_label' => 'Skos association', + ]; + $vocabulary = [ - 'id' => 'skos_vocabulary', - 'label' => 'My skos vocabulary', + 'id' => $names['vocabulary_id'], + 'label' => $names['vocabulary_label'], 'description' => $this->randomString(128), 'handler' => 'rdf_skos', 'handler_settings' => [ @@ -74,14 +83,14 @@ public function createSkosVocabularyAssociation(array $fields, array $concept_sc $vocabulary->save(); $vocabulary_association_values = [ - 'label' => 'Skos association', - 'name' => 'skos_vocabulary', + 'label' => $names['association_label'], + 'name' => $names['association_id'], 'widget_type' => 'entity_reference_autocomplete', 'required' => TRUE, 'help_text' => 'Some text', 'predicate' => 'http://example.com/#name', 'cardinality' => 5, - 'vocabulary' => 'skos_vocabulary', + 'vocabulary' => $names['vocabulary_id'], 'fields' => $fields, ]; $this->container->get('kernel')->rebuildContainer();