Commit af6990f8 authored by Stephen Lucero's avatar Stephen Lucero
Browse files

Issue #3295521 by slucero: Call to undefined method...

Issue #3295521 by slucero: Call to undefined method Drupal\Core\Extension\ModuleHandler::hasImplementations() for Drupal 9 < 9.4
parent 62785cc0
Loading
Loading
Loading
Loading
+4 −1
Original line number Diff line number Diff line
@@ -744,7 +744,10 @@ class Library extends CacheCollector implements LibraryInterface, ContainerInjec

    // Allow modules to add dynamic library definitions.
    $hook = 'library_info_build';
    if ($this->moduleHandler->hasImplementations($hook, $extension)) {
    // @todo Refactor library info building and hook invocation to use invokeAll() method instead.
    // @see https://www.drupal.org/node/3000490
    // @see https://www.drupal.org/project/patternkit/issues/3295521
    if ($this->moduleHandler->implementsHook($extension, $hook)) {
      $libraries = NestedArray::mergeDeep($libraries, $this->moduleHandler->invoke($extension, $hook));
    }

+6 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Drupal\Tests\BrowserTestBase;
 *
 * @coversDefaultClass \Drupal\patternkit\Form\PatternkitSettingsForm
 * @group patternkit
 * @group legacy
 */
class PatternkitSettingsTest extends BrowserTestBase {

@@ -66,6 +67,11 @@ class PatternkitSettingsTest extends BrowserTestBase {
   * Test that the settings form loads as expected.
   */
  public function testPatternkitSettingsForm() {
    // @todo Remove this once the referenced deprecation is resolved.
    // @see https://www.drupal.org/node/3000490
    // @see https://www.drupal.org/project/patternkit/issues/3295521
    $this->expectDeprecation('ModuleHandlerInterface::implementsHook() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Instead you should use ModuleHandlerInterface::hasImplementations()  with the $modules argument. See https://www.drupal.org/node/3000490');

    $account = $this->drupalCreateUser(['access administration pages']);
    $this->drupalLogin($account);

+6 −0
Original line number Diff line number Diff line
@@ -15,6 +15,7 @@ use Drupal\patternkit\Plugin\PatternFieldProcessor\WysiwygFieldProcessor;
 * Test pattern field processor plugin manager functionality.
 *
 * @group patternkit
 * @group legacy
 */
class PatternFieldProcessorPluginManagerTest extends KernelTestBase {

@@ -48,6 +49,11 @@ class PatternFieldProcessorPluginManagerTest extends KernelTestBase {
    $this->installEntitySchema('node');

    $this->pluginManager = $this->container->get('plugin.manager.pattern_field_processor');

    // @todo Remove this once the referenced deprecation is resolved.
    // @see https://www.drupal.org/node/3000490
    // @see https://www.drupal.org/project/patternkit/issues/3295521
    $this->expectDeprecation('ModuleHandlerInterface::implementsHook() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Instead you should use ModuleHandlerInterface::hasImplementations()  with the $modules argument. See https://www.drupal.org/node/3000490');
  }

  /**
+6 −0
Original line number Diff line number Diff line
@@ -9,6 +9,7 @@ use Drupal\patternkit\Asset\LibraryInterface;
 * Test pattern library functionality.
 *
 * @group patternkit
 * @group legacy
 */
class PatternLibraryTest extends KernelTestBase {

@@ -25,6 +26,11 @@ class PatternLibraryTest extends KernelTestBase {
   * Test that example module patterns are discovered successfully.
   */
  public function testExamplePatternsAreDiscovered() {
    // @todo Remove this once the referenced deprecation is resolved.
    // @see https://www.drupal.org/node/3000490
    // @see https://www.drupal.org/project/patternkit/issues/3295521
    $this->expectDeprecation('ModuleHandlerInterface::implementsHook() is deprecated in drupal:9.4.0 and is removed from drupal:10.0.0. Instead you should use ModuleHandlerInterface::hasImplementations()  with the $modules argument. See https://www.drupal.org/node/3000490');

    /** @var \Drupal\patternkit\Asset\LibraryInterface $library */
    $library = $this->container->get('patternkit.asset.library');
    $this->assertNotNull($library);