Classes, traits, and interfaces - main - drupal

Primary tabs

Introduction to classes

A lot of the PHP code in Drupal is object oriented (OO), making use of PHP classes, interfaces, and traits. See the Objected-oriented programming conventions for more information.

See also

Objected-oriented programming conventions

File

core/core.api.php, line 1529

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
TestPluginManager class Drupal\plugin_test\Plugin core/modules/system/tests/modules/plugin_test/src/Plugin/TestPluginManager.php Defines a plugin manager used by Plugin API unit tests. 1
TestPluginManagerWithDefaults class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php Plugin manager test class with defaults assigned.
TestPluginSettingsBase class Drupal\Tests\Core\Field core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php Stub class for testing PluginSettingsBase.
TestPluginWithForm class Drupal\Tests\Core\Theme\Icon core/tests/Drupal/Tests/Core/Theme/Icon/IconPackExtractorFormTest.php Test class for form.
TestPreinstallInterface interface Drupal\TestSite core/tests/Drupal/TestSite/TestPreinstallInterface.php Allows running code prior to a test site install. 1 1
TestPrepareLayout class Drupal\layout_builder_element_test\EventSubscriber core/modules/layout_builder/tests/modules/layout_builder_element_test/src/EventSubscriber/TestPrepareLayout.php Provides an event subscriber for testing section storage alteration. 2
TestPrivateService class Drupal\services_defaults_test core/modules/system/tests/modules/services_defaults_test/src/TestPrivateService.php A service to test private flag.
TestProfilerExtension class Drupal\sdc_other_node_visitor\Twig\Extension core/modules/system/tests/modules/sdc_other_node_visitor/src/Twig/Extension/TestProfilerExtension.php Twig extension to add a test node visitor. 2
TestRequirementsTrait trait Drupal\Tests core/tests/Drupal/Tests/TestRequirementsTrait.php Allows test classes to require Drupal modules as dependencies. 1
TestResponseController final class Drupal\http_middleware_test\Controller core/modules/system/tests/modules/http_middleware_test/src/Controller/TestResponseController.php Controller routines for http_middleware_test routes.
TestRouteProvider class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php Provides a test entity route provider.
TestRouteProvider class Drupal\KernelTests\Core\Routing core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php Stub class for testing RouteProvider.
TestRouterInterface interface Drupal\Tests\Core\Routing core/tests/Drupal/Tests/Core/Routing/TestRouterInterface.php Provides a router interface that also can match requests. 2
TestRouteSubscriber class Drupal\Tests\Core\Routing core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php Provides a callback for route definition.
TestRouteSubscriber class Drupal\Tests\views\Unit\EventSubscriber core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php Provides a test route subscriber.
TestRun class Drupal\Core\Test core/lib/Drupal/Core/Test/TestRun.php Implements an object that tracks execution of a test run. 3
TestRunnerFinishedSubscriber final class Drupal\TestTools\Extension\HtmlLogging core/tests/Drupal/TestTools/Extension/HtmlLogging/TestRunnerFinishedSubscriber.php Event subscriber notifying end of test runner execution to HTML logging.
TestRunnerFinishedSubscriber final class Drupal\TestTools\Extension\Dump core/tests/Drupal/TestTools/Extension/Dump/TestRunnerFinishedSubscriber.php Event subscriber notifying end of test runner execution to HTML logging.
TestRunnerKernel class Drupal\Core\Test core/lib/Drupal/Core/Test/TestRunnerKernel.php Defines a kernel used for running Functional tests and run-tests.sh.
TestRunnerStartedSubscriber final class Drupal\TestTools\Extension\HtmlLogging core/tests/Drupal/TestTools/Extension/HtmlLogging/TestRunnerStartedSubscriber.php Event subscriber notifying beginning of test runner to HTML logging.
TestRunResultsStorageInterface interface Drupal\Core\Test core/lib/Drupal/Core/Test/TestRunResultsStorageInterface.php Interface describing a test run results storage object. 1 2
TestRunTest class Drupal\KernelTests\Core\Test core/tests/Drupal/KernelTests/Core/Test/TestRunTest.php Tests Drupal\Core\Test\TestRun.
TestSandboxDatabaseUpdatesValidator class Drupal\package_manager_test_validation core/modules/package_manager/tests/modules/package_manager_test_validation/src/TestSandboxDatabaseUpdatesValidator.php Allows tests to dictate which extensions have staged database updates.
TestSandboxManager class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php Defines a stage specifically for testing purposes. 1
TestSearchPage class Drupal\Tests\search\Unit core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php Mock for the configured search page entity.
TestSectionList class Drupal\Tests\layout_builder\Kernel core/modules/layout_builder/tests/src/Kernel/SectionListTraitTest.php Test item list class for layout section fields.
TestSelection class Drupal\block_content_test\Plugin\EntityReferenceSelection core/modules/block_content/tests/modules/block_content_test/src/Plugin/EntityReferenceSelection/TestSelection.php Test EntityReferenceSelection with conditions on the 'reusable' field. 1
TestService class Drupal\decorated_service_test core/modules/system/tests/modules/decorated_service_test/src/TestService.php A service class for handling test functionality. 1 3
TestService class Drupal\services_defaults_test core/modules/system/tests/modules/services_defaults_test/src/TestService.php An autowired service to test _defaults. 2
TestService class Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestService.php Service class for managing injected dependencies. 1
TestServiceComplexMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php Call used to test a service with a complex method.
TestServiceComplexMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with complex method.
TestServiceDecorator class Drupal\decorated_service_test core/modules/system/tests/modules/decorated_service_test/src/TestServiceDecorator.php Decorator for the TestService class. 1 4
TestServiceMethodReturnsVoid class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with void returning method.
TestServiceMethodWithParameter class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with method without parameter.
TestServiceNoMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service without methods.
TestServiceNoMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php Class used to test a service that has no methods.
TestServiceNullableTypeHintSelf class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with a nullable self parameter.
TestServiceReturnReference class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with method that returns reference.
TestServiceSimpleMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with simple method.
TestServiceWithChildInterfaces class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service that implements test child interface.
TestServiceWithInterface class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service that implements test interface.
TestServiceWithProtectedMethods class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with protected methods.
TestServiceWithPublicStaticMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with public static method.
TestSessionBag class Drupal\session_test\Session core/modules/system/tests/modules/session_test/src/Session/TestSessionBag.php Test session container. 1 2
TestSessionHandlerProxy class Drupal\session_test\Session core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php Provides a test session handler proxy. 3
TestSettingsValidationBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestSettingsValidationBlock.php Provides a test settings validation block.
TestSetupInterface interface Drupal\TestSite core/tests/Drupal/TestSite/TestSetupInterface.php Allows setting up an environment as part of a test site install. 6 2
TestSetupTrait trait Drupal\Core\Test core/lib/Drupal/Core/Test/TestSetupTrait.php Provides a trait for shared test setup functionality. 3
TestSetupTraitTest class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php Tests the TestSetupTrait trait.

Other projects


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