function ImplementationListTest::testEmptyList

Tests public methods on an empty list.

File

core/tests/Drupal/Tests/Core/Hook/ImplementationListTest.php, line 75

Class

ImplementationListTest
Tests ImplementationList.

Namespace

Drupal\Tests\Core\Hook

Code

public function testEmptyList() : void {
  $list = new ImplementationList([], []);
  // Test public properties.
  $this->assertSame([], $list->listeners);
  $this->assertSame([], $list->modules);
  // Test iterateByModule().
  $iterator = $list->iterateByModule();
  $this->assertFalse($iterator->valid());
  // Test hasImplementations().
  $this->assertFalse($list->hasImplementations());
  // Test getForModule().
  $this->assertSame([], $list->getForModule('any_module'));
  // Test hasImplementationsForModules().
  $this->assertFalse($list->hasImplementationsForModules([
    'any_module',
  ]));
  $this->assertFalse($list->hasImplementationsForModules([]));
}

Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.