function ServicesDefaultsTest::testPrivateServices

Same name in other branches
  1. 9 core/tests/Drupal/KernelTests/Core/DependencyInjection/ServicesDefaultsTest.php \Drupal\KernelTests\Core\DependencyInjection\ServicesDefaultsTest::testPrivateServices()
  2. 11.x core/tests/Drupal/KernelTests/Core/DependencyInjection/ServicesDefaultsTest.php \Drupal\KernelTests\Core\DependencyInjection\ServicesDefaultsTest::testPrivateServices()

Tests that service from 'services_defaults_test.service' is private.

File

core/tests/Drupal/KernelTests/Core/DependencyInjection/ServicesDefaultsTest.php, line 82

Class

ServicesDefaultsTest
Tests services _defaults definition.

Namespace

Drupal\KernelTests\Core\DependencyInjection

Code

public function testPrivateServices() : void {
    // Ensure default and overridden public flag works.
    $this->expectException(ServiceNotFoundException::class);
    $this->container
        ->getDefinition('Drupal\\services_defaults_test\\TestPrivateService');
}

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