diff --git a/drupalci.yml b/drupalci.yml new file mode 100644 index 0000000000000000000000000000000000000000..5de9c8a80bc1799cad6b5c886e3319cd8f3fae6e --- /dev/null +++ b/drupalci.yml @@ -0,0 +1,42 @@ +# This is the DrupalCI testbot build file for Dynamic Entity Reference. +# Learn to make one for your own drupal.org project: +# https://www.drupal.org/drupalorg/docs/drupal-ci/customizing-drupalci-testing +build: + assessment: + validate_codebase: + phplint: + # Re-run composer install to ensure the dependencies resolve for the + # containerized PHP version. + container_composer: + options: ' install --prefer-dist --no-suggest --no-progress --no-interaction' + halt-on-fail: true + phpcs: + # phpcs will use core's specified version of Coder. + sniff-all-files: true + halt-on-fail: true + testing: + # run_tests task is executed several times in order of performance speeds. + # halt-on-fail can be set on the run_tests tasks in order to fail fast. + # suppress-deprecations is false in order to be alerted to usages of + # deprecated code. + run_tests.phpunit: + types: 'PHPUnit-Unit' + testgroups: '--all' + suppress-deprecations: false + halt-on-fail: false + run_tests.kernel: + types: 'PHPUnit-Kernel' + testgroups: '--all' + suppress-deprecations: false + halt-on-fail: false + run_tests.functional: + types: 'PHPUnit-Functional' + testgroups: '--all' + suppress-deprecations: false + halt-on-fail: false + run_tests.javascript: + concurrency: 15 + types: 'PHPUnit-FunctionalJavascript' + testgroups: '--all' + suppress-deprecations: false + halt-on-fail: false diff --git a/phpcs.xml b/phpcs.xml new file mode 100644 index 0000000000000000000000000000000000000000..01d0b82d7f669bc05321694c2c65abde0276989a --- /dev/null +++ b/phpcs.xml @@ -0,0 +1,12 @@ + + + Default PHP CodeSniffer configuration for Dynamic Entity Reference. + . + + + + README\.md + CHANGELOG\.md + + + diff --git a/phpcs.xml.dist b/phpcs.xml.dist deleted file mode 100644 index 5e2b0d98db34199350cf1510b384f83d14ea41b7..0000000000000000000000000000000000000000 --- a/phpcs.xml.dist +++ /dev/null @@ -1,287 +0,0 @@ - - - - Drupal coding standard - - - - - - - - * - - - - - *.txt - - - - *.tpl.php - - - - *.tpl.php - - - - - 0 - - - 0 - - - - 0 - - - - - *.tpl.php - - - - - - - - - 0 - - - - - - - - - - - - - - - - - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - 0 - - - 0 - - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - - - - 0 - - - 0 - - - 0 - - - - - 0 - - - 0 - - - - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - 0 - - - - - 0 - - - - 0 - - - - - - - - - - - - - - - - - - - - 0 - - - - - 0 - - - 0 - - - - 0 - - - 0 - - - 0 - - - - - - - - - - - - - - - - - - - - - - *.tpl.php - - - - */\.git/* - */\.svn/* - */\.hg/* - */\.bzr/* - diff --git a/src/DynamicEntityReferenceServiceProvider.php b/src/DynamicEntityReferenceServiceProvider.php index b3f76f0d2cdd8774ab80b24fb9f28cca6f6dfd70..906f0fe76ffde9aab6a135caeb6aca6416ba6ac4 100644 --- a/src/DynamicEntityReferenceServiceProvider.php +++ b/src/DynamicEntityReferenceServiceProvider.php @@ -6,7 +6,6 @@ use Drupal\Core\DependencyInjection\ContainerBuilder; use Drupal\Core\DependencyInjection\ServiceProviderBase; use Drupal\dynamic_entity_reference\Normalizer\DynamicEntityReferenceItemNormalizer; use Symfony\Component\DependencyInjection\Definition; -use Symfony\Component\DependencyInjection\Reference; /** * Service Provider for Dynamic Entity Reference. @@ -31,7 +30,7 @@ class DynamicEntityReferenceServiceProvider extends ServiceProviderBase { // The priority must be higher than that of // serializer.normalizer.entity_reference_item.hal in // hal.services.yml. - $service_definition->addTag('normalizer', array('priority' => $parent_definition->getTags()['normalizer'][0]['priority'] + 1)); + $service_definition->addTag('normalizer', ['priority' => $parent_definition->getTags()['normalizer'][0]['priority'] + 1]); $container->setDefinition('serializer.normalizer.entity.dynamic_entity_reference_item.hal', $service_definition); } diff --git a/tests/src/FunctionalJavascript/DynamicEntityReferenceTest.php b/tests/src/FunctionalJavascript/DynamicEntityReferenceTest.php index 3bcb475b41232eae27d1c43d8c983ecec702b5e8..defb647c08ae193d74bf537f3835b3c2ddbba800 100644 --- a/tests/src/FunctionalJavascript/DynamicEntityReferenceTest.php +++ b/tests/src/FunctionalJavascript/DynamicEntityReferenceTest.php @@ -107,13 +107,10 @@ class DynamicEntityReferenceTest extends WebDriverTestBase { $this->drupalGet('entity_test/structure/entity_test/fields/add-field'); $select = $assert_session->selectExists('new_storage_type'); $select->selectOption('dynamic_entity_reference'); - // This is needed to execute machine name JS. $label = $assert_session->fieldExists('label'); - $label->focus(); $label->setValue('Foobar'); - $label->blur(); - $select->focus(); - sleep(1); + // Wait for the machine name. + $assert_session->waitForElementVisible('css', '[name="label"] + * .machine-name-value'); $this->submitForm([], t('Save and continue'), 'field-ui-field-storage-add-form'); $page = $this->getSession()->getPage(); $entity_type_ids_select = $assert_session->selectExists('settings[entity_type_ids][]', $page); @@ -187,13 +184,10 @@ class DynamicEntityReferenceTest extends WebDriverTestBase { $this->drupalGet('/admin/structure/types/manage/test_content/fields/add-field'); $select = $assert_session->selectExists('new_storage_type'); $select->selectOption('dynamic_entity_reference'); - // This is needed to execute machine name JS. $label = $assert_session->fieldExists('label'); - $label->focus(); $label->setValue('Foobar'); - $label->blur(); - $select->focus(); - sleep(1); + // Wait for the machine name. + $assert_session->waitForElementVisible('css', '[name="label"] + * .machine-name-value'); $this->submitForm([], t('Save and continue'), 'field-ui-field-storage-add-form'); $page = $this->getSession()->getPage(); $entity_type_ids_select = $assert_session->selectExists('settings[entity_type_ids][]', $page); diff --git a/tests/src/Kernel/DynamicEntityReferenceFormatterTest.php b/tests/src/Kernel/DynamicEntityReferenceFormatterTest.php index b1fac364739d999c79f31ffedf55bb6c00014a6a..72990b0add35cbb61d2982fbb76d688f35ce4ed4 100644 --- a/tests/src/Kernel/DynamicEntityReferenceFormatterTest.php +++ b/tests/src/Kernel/DynamicEntityReferenceFormatterTest.php @@ -82,7 +82,6 @@ class DynamicEntityReferenceFormatterTest extends EntityKernelTestBase { ->save(); // The label formatter rendering generates links, so build the router. - $this->installSchema('system', 'router'); $this->container->get('router.builder')->rebuild(); FieldStorageConfig::create([ diff --git a/tests/src/Kernel/EntityQueryRelationshipTest.php b/tests/src/Kernel/EntityQueryRelationshipTest.php index 5de7ee9be16c4c75fcaf1a02f4719ecd44a0736d..7ae8aebd990dd1893867cf345ded53993b043456 100644 --- a/tests/src/Kernel/EntityQueryRelationshipTest.php +++ b/tests/src/Kernel/EntityQueryRelationshipTest.php @@ -51,13 +51,6 @@ class EntityQueryRelationshipTest extends EntityKernelTestBase { */ protected $fieldName = 'field_test'; - /** - * The entity field query factory. - * - * @var \Drupal\Core\Entity\Query\QueryFactory - */ - protected $factory; - /** * The results returned by EntityQuery. * @@ -101,7 +94,6 @@ class EntityQueryRelationshipTest extends EntityKernelTestBase { 'label' => 'Field test', 'settings' => [], ])->save(); - $this->factory = \Drupal::service('entity.query'); } /** @@ -131,7 +123,9 @@ class EntityQueryRelationshipTest extends EntityKernelTestBase { $this->entities[] = $entity; // This returns the 0th entity as that's only one pointing to the 0th // account. - $this->queryResults = $this->factory->get('entity_test') + $this->queryResults = $this->container->get('entity_type.manager') + ->getStorage('entity_test') + ->getQuery() ->condition("field_test.0.entity:entity_test_rev.name", 'Foobar') ->condition("field_test.1.entity:entity_test_rev.name", 'Barfoo') ->execute();