You are here

public function UnitTestBase::containerMockGetServiceCallback in Select (or other) 8

Same name and namespace in other branches
  1. 4.x tests/src/Unit/UnitTestBase.php \Drupal\Tests\select_or_other\Unit\UnitTestBase::containerMockGetServiceCallback()

Callback for the get method on the mocked service container.

Parameters

string $service_id: The service identifier being called.

Return value

mixed A (mocked) service class if one has been set for the given service id or NULL.

File

tests/src/Unit/UnitTestBase.php, line 165

Class

UnitTestBase

Namespace

Drupal\Tests\select_or_other\Unit

Code

public function containerMockGetServiceCallback($service_id) {
  if (isset($this->services[$service_id])) {
    return $this->services[$service_id];
  }
  return NULL;
}