localgovdrupal / localgov_page_components

Reusable paragraphs library for LocalGovDrupal distribution.
GNU General Public License v2.0
0 stars 1 forks source link

Feature/13 apply linkit integration #18

Closed mattrfletcher closed 3 years ago

mattrfletcher commented 3 years ago

Fix for #13 apply linkit integration.

Adnan-cds commented 3 years ago

Hi Matt, The 1.x Git branch now has an updated Github actions test runner file. If you please merge the 1.x branch with this branch, the tests should run and point out any pending issues with this change.

mattrfletcher commented 3 years ago

@Adnan-cds @stephen-cox

I've merged the 1.x branch and added the check for the presence of Linkit.

The fixed merge conflicts commit is the one that contains 1.x so should hopefully pass.

Adnan-cds commented 3 years ago

Sorry Matt, there's a quite a few coding standards issues. If you please check the test logs and try to resolve those. Let me know if you need any help.

mattrfletcher commented 3 years ago

@Adnan-cds I've hopefully fixed a couple issues but not all so will still fail. I might get a colleague to help next week but if you could provide any help that would be appreciated.

mattrfletcher commented 3 years ago

Hi @Adnan-cds

I've been working with @danchamp today on the failing checks and the code checks now pass. The only problem is the PHPUnit tests not passing. Dan's thoughts are:

'There’s something going on with the availability of Linkit to other modules during testing. I can’t see that Linkit is enabled by default in LGD, which might have something to do with it.'

Any thoughts on this and why the tests are failing.

Adnan-cds commented 3 years ago

Any thoughts on this and why the tests are failing.

Hi Matt, I am looking into this.

Adnan-cds commented 3 years ago

Hi Matt, Could you please make the following code changes and see if the tests all pass:

diff --git a/localgov_page_components.install b/localgov_page_components.install
index 33be544..4f11e1e 100644
--- a/localgov_page_components.install
+++ b/localgov_page_components.install
@@ -37,11 +37,15 @@ function localgov_page_components_install($is_syncing) {

   /** @var \Drupal\linkit\ProfileInterface $defaultLinkItProfile */
   $defaultLinkItProfile = \Drupal::service('entity_type.manager')->getStorage('linkit_profile')->load('default');
+  if (empty($defaultLinkItProfile)) {
+    // Applies during test runs.
+    return;
+  }
+
   foreach ($defaultLinkItProfile->getMatchers() as $matcher) {
     if ($matcher->getPluginId() == 'entity:paragraphs_library_item') {
       return;
     }
-
   }

   $defaultLinkItProfile->addMatcher([
Adnan-cds commented 3 years ago

Okay, nearly there. Some more coding standard issues have popped up. If you please have a look Mark.

Adnan-cds commented 3 years ago

All looks good. Once you mark this pull request as "Ready for review" instead of "Draft", we should merge it.

mattrfletcher commented 3 years ago

All looks good. Once you mark this pull request as "Ready for review" instead of "Draft", we should merge it.

I've now marked it as ready for review.

Adnan-cds commented 3 years ago

Thanks a ton Matt. All done :+1:

mattrfletcher commented 3 years ago

Thanks a ton Matt. All done +1

That's alright. Thanks for the help getting finished and merged.