Skip to main content
Drupal API
User account menu
  • Log in

Breadcrumb

  1. Drupal Core 11.1.x
  2. ServiceLocatorTestCase.php

function ServiceLocatorTestCase::testHas

File

vendor/symfony/service-contracts/Test/ServiceLocatorTestCase.php, line 29

Class

ServiceLocatorTestCase

Namespace

Symfony\Contracts\Service\Test

Code

public function testHas() {
    $locator = $this->getServiceLocator([
        'foo' => fn() => 'bar',
        'bar' => fn() => 'baz',
        fn() => 'dummy',
    ]);
    $this->assertTrue($locator->has('foo'));
    $this->assertTrue($locator->has('bar'));
    $this->assertFalse($locator->has('dummy'));
}
RSS feed
Powered by Drupal