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

Breadcrumb

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

function ServiceLocatorTestCase::testGetDoesNotMemoize

File

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

Class

ServiceLocatorTestCase

Namespace

Symfony\Contracts\Service\Test

Code

public function testGetDoesNotMemoize() {
    $i = 0;
    $locator = $this->getServiceLocator([
        'foo' => function () use (&$i) {
            ++$i;
            return 'bar';
        },
    ]);
    $this->assertSame('bar', $locator->get('foo'));
    $this->assertSame('bar', $locator->get('foo'));
    $this->assertSame(2, $i);
}

API Navigation

  • Drupal Core 11.1.x
  • Topics
  • Classes
  • Functions
  • Constants
  • Globals
  • Files
  • Namespaces
  • Deprecated
  • Services
RSS feed
Powered by Drupal