TestService.php

Same filename in this branch
  1. 11.x core/modules/system/tests/modules/decorated_service_test/src/TestService.php
  2. 11.x core/modules/system/tests/modules/services_defaults_test/src/TestService.php
Same filename and directory in other branches
  1. 9 core/modules/system/tests/modules/decorated_service_test/src/TestService.php
  2. 9 core/modules/system/tests/modules/services_defaults_test/src/TestService.php
  3. 9 core/modules/system/tests/modules/autowire_test/src/TestService.php
  4. 10 core/modules/system/tests/modules/decorated_service_test/src/TestService.php
  5. 10 core/modules/system/tests/modules/services_defaults_test/src/TestService.php
  6. 10 core/modules/system/tests/modules/autowire_test/src/TestService.php

Namespace

Drupal\autowire_test

File

core/modules/system/tests/modules/autowire_test/src/TestService.php

View source
<?php

declare (strict_types=1);
namespace Drupal\autowire_test;

use Drupal\Core\Database\Connection;
use Drupal\Core\DrupalKernelInterface;

/**
 * Service class for managing injected dependencies.
 */
class TestService {
  
  /**
   * @var \Drupal\autowire_test\TestInjectionInterface
   */
  protected $testInjection;
  
  /**
   * @var \Drupal\autowire_test\TestInjection2
   */
  protected $testInjection2;
  
  /**
   * The database connection.
   *
   * @var \Drupal\Core\Database\Connection
   */
  protected $database;
  
  /**
   * The Drupal kernel.
   *
   * @var \Drupal\Core\DrupalKernelInterface
   */
  protected $kernel;
  public function __construct(TestInjectionInterface $test_injection, TestInjection2 $test_injection2, Connection $database, DrupalKernelInterface $kernel, protected TestInjectionInterface $testInjection3) {
    $this->testInjection = $test_injection;
    $this->testInjection2 = $test_injection2;
    $this->database = $database;
    $this->kernel = $kernel;
  }
  public function getTestInjection() : TestInjectionInterface {
    return $this->testInjection;
  }
  public function getTestInjection2() : TestInjection2 {
    return $this->testInjection2;
  }
  public function getTestInjection3() : TestInjection3 {
    return $this->testInjection3;
  }
  public function getDatabase() : Connection {
    return $this->database;
  }
  public function getKernel() : DrupalKernelInterface {
    return $this->kernel;
  }

}

Classes

Title Deprecated Summary
TestService Service class for managing injected dependencies.

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