From b0b61dbc5e1473e3e96da60a55f323000cb33d92 Mon Sep 17 00:00:00 2001 From: Arlina Espinoza Rhoton Date: Fri, 18 Sep 2020 14:19:12 -0700 Subject: [PATCH] #478 Enable CI testing matrix against D8/D9, fix deprecations (#490) * [#478] Enable testing matrix against D8 and D9. * [#478] Fix ResponseTemplateLoader in apigee_mock_api_client. * [#478] Add scaffolding files to CI composer. * [#478] Fixing tests. * [#478] Fixed AuthenticationFormJsTest. * [#478] Fixed DeveloperTest. * [#478] Fixed deprecated service in EdgeEntityListBuilder. --- .circleci/RoboFile.php | 6 ++++++ .circleci/config.yml | 8 ++++---- src/Entity/ListBuilder/EdgeEntityListBuilder.php | 2 +- .../src/TwigExtension/ResponseTemplateLoader.php | 6 +++--- tests/src/Functional/DeveloperTest.php | 2 +- .../ApigeeEdgeFunctionalJavascriptTestBase.php | 7 +++++++ .../Form/AuthenticationFormJsTest.php | 5 +++++ 7 files changed, 27 insertions(+), 9 deletions(-) diff --git a/.circleci/RoboFile.php b/.circleci/RoboFile.php index a78d42740..c32b1f21d 100644 --- a/.circleci/RoboFile.php +++ b/.circleci/RoboFile.php @@ -47,6 +47,10 @@ public function setupSkeleton() $config = json_decode(file_get_contents('composer.json')); $config->extra->{"enable-patching"} = 'true'; $config->extra->{"patches"} = new \stdClass(); + $config->extra->{"drupal-scaffold"} = new \stdClass(); + $config->extra->{"drupal-scaffold"}->{"locations"} = (object) [ + 'web-root' => '.', + ]; file_put_contents('composer.json', json_encode($config)); @@ -425,12 +429,14 @@ public function drupalVersion($drupalCoreVersion) switch ($drupalCoreVersion) { case '9': + $config->require->{"drupal/core-composer-scaffold"} = '^9'; $config->require->{"drupal/core-recommended"} = '^9'; $config->require->{"drupal/core-dev"} = '^9'; break; case '8': + $config->require->{"drupal/core-composer-scaffold"} = '~8'; $config->require->{"drupal/core-recommended"} = '~8'; $config->require->{"drupal/core-dev"} = '~8'; diff --git a/.circleci/config.yml b/.circleci/config.yml index 012329393..1d47d753c 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -246,7 +246,7 @@ workflows: name: update-dependencies-<< matrix.core-version >> matrix: parameters: - core-version: [8] + core-version: [8, 9] - run-code-sniffer: requires: - update-dependencies-8 @@ -257,21 +257,21 @@ workflows: name: run-unit-kernel-tests-<< matrix.core-version >> matrix: parameters: - core-version: [8] + core-version: [8, 9] requires: - update-dependencies-<< matrix.core-version >> - run-functional-tests: name: run-functional-tests-<< matrix.core-version >> matrix: parameters: - core-version: [8] + core-version: [8, 9] requires: - update-dependencies-<< matrix.core-version >> - run-functional-js-tests: name: run-functional-js-tests-<< matrix.core-version >> matrix: parameters: - core-version: [8] + core-version: [8, 9] requires: - update-dependencies-<< matrix.core-version >> # - run-code-coverage: diff --git a/src/Entity/ListBuilder/EdgeEntityListBuilder.php b/src/Entity/ListBuilder/EdgeEntityListBuilder.php index a22dac229..aefbed1db 100644 --- a/src/Entity/ListBuilder/EdgeEntityListBuilder.php +++ b/src/Entity/ListBuilder/EdgeEntityListBuilder.php @@ -88,7 +88,7 @@ public function __construct(EntityTypeInterface $entity_type, EntityTypeManagerI public static function createInstance(ContainerInterface $container, EntityTypeInterface $entity_type) { return new static( $entity_type, - $container->get('entity.manager'), + $container->get('entity_type.manager'), $container->get('config.factory') ); } diff --git a/tests/modules/apigee_mock_api_client/src/TwigExtension/ResponseTemplateLoader.php b/tests/modules/apigee_mock_api_client/src/TwigExtension/ResponseTemplateLoader.php index 4e3b3808c..ed80b4c7e 100644 --- a/tests/modules/apigee_mock_api_client/src/TwigExtension/ResponseTemplateLoader.php +++ b/tests/modules/apigee_mock_api_client/src/TwigExtension/ResponseTemplateLoader.php @@ -52,14 +52,14 @@ public function __construct(ModuleHandlerInterface $module_handler) { /** * {@inheritdoc} */ - protected function normalizeName($name) { - $name = str_replace('_', '-', parent::normalizeName($name)); + protected function findTemplate($name, $throw = TRUE) { + $name = str_replace('_', '-', $name); if (strpos($name, '.twig') === FALSE) { $name = "{$name}.json.twig"; } - return $name; + return parent::findTemplate($name, $throw); } } diff --git a/tests/src/Functional/DeveloperTest.php b/tests/src/Functional/DeveloperTest.php index ed5a308fe..d301b8170 100644 --- a/tests/src/Functional/DeveloperTest.php +++ b/tests/src/Functional/DeveloperTest.php @@ -416,7 +416,7 @@ protected function developerCreateByAdminTest() { // too. $this->stack->queueMockResponse('get_not_found'); $loaded = $this->developerStorage->loadUnchanged($test_user['email']); - $this->assertFalse($loaded, 'Developer does not exists anymore.'); + $this->assertEmpty($loaded, 'Developer does not exists anymore.'); } /** diff --git a/tests/src/FunctionalJavascript/ApigeeEdgeFunctionalJavascriptTestBase.php b/tests/src/FunctionalJavascript/ApigeeEdgeFunctionalJavascriptTestBase.php index 4f9f9a783..d3c553f50 100644 --- a/tests/src/FunctionalJavascript/ApigeeEdgeFunctionalJavascriptTestBase.php +++ b/tests/src/FunctionalJavascript/ApigeeEdgeFunctionalJavascriptTestBase.php @@ -29,6 +29,13 @@ abstract class ApigeeEdgeFunctionalJavascriptTestBase extends WebDriverTestBase use ApigeeEdgeFunctionalTestTrait; + /** + * For tests relying on no markup at all or at least no core markup. + * + * @var string + */ + protected $defaultTheme = 'stark'; + /** * {@inheritdoc} */ diff --git a/tests/src/FunctionalJavascript/Form/AuthenticationFormJsTest.php b/tests/src/FunctionalJavascript/Form/AuthenticationFormJsTest.php index d5657f5c0..a8ae50ea8 100644 --- a/tests/src/FunctionalJavascript/Form/AuthenticationFormJsTest.php +++ b/tests/src/FunctionalJavascript/Form/AuthenticationFormJsTest.php @@ -34,6 +34,11 @@ */ class AuthenticationFormJsTest extends ApigeeEdgeFunctionalJavascriptTestBase { + /** + * {@inheritdoc} + */ + protected $defaultTheme = 'classy'; + /** * Valid username. *