Classes, traits, and interfaces - 10.3.x - 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 1518

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
TestObject class Drupal\Tests\serialization\Unit\Encoder core/modules/serialization/tests/src/Unit/Encoder/XmlEncoderTest.php
TestObjectItem class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestObjectItem.php Defines the 'test_object_field' entity field item.
TestObjectItemTest class Drupal\Tests\field\Kernel core/modules/field/tests/src/Kernel/TestObjectItemTest.php Tests the serialization of an object.
TestPageDisplayVariantSubscriber class Drupal\display_variant_test\EventSubscriber core/modules/system/tests/modules/display_variant_test/src/EventSubscriber/TestPageDisplayVariantSubscriber.php Selects the test page display variant. 2
TestPageTestController class Drupal\test_page_test\Controller core/modules/system/tests/modules/test_page_test/src/Controller/TestPageTestController.php Controller routines for test_page_test routes.
TestPathBasedBreadcrumbBuilder class Drupal\Tests\system\Unit\Breadcrumbs core/modules/system/tests/src/Unit/Breadcrumbs/PathBasedBreadcrumbBuilderTest.php Helper class for testing purposes only.
TestPerComponentEntityDisplay class Drupal\Tests\migrate\Unit\destination core/modules/migrate/tests/src/Unit/destination/PerComponentEntityDisplayTest.php
TestPerComponentEntityFormDisplay class Drupal\Tests\migrate\Unit\destination core/modules/migrate/tests/src/Unit/destination/PerComponentEntityFormDisplayTest.php
TestPermissionCallbacks class Drupal\Tests\user\Unit core/modules/user/tests/src/Unit/PermissionHandlerTest.php
TestPhpMailFailure class Drupal\system_mail_failure_test\Plugin\Mail core/modules/system/tests/modules/system_mail_failure_test/src/Plugin/Mail/TestPhpMailFailure.php Defines a mail sending implementation that always fails. 1
TestPlaceholderingRenderCache class Drupal\Tests\Core\Render core/tests/Drupal/Tests/Core/Render/RendererPlaceholdersTest.php
TestPluginBase class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php Helper class for using the PluginBase abstract class.
TestPluginDependency class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/PluginDependencyTraitTest.php
TestPluginForm class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/DefaultPluginManagerTest.php
TestPluginManager class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php A plugin manager for condition plugins. 1
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
TestPluginSettingsBase class Drupal\Tests\Core\Field core/tests/Drupal/Tests/Core/Field/PluginSettingsBaseTest.php
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.
TestRouteBuilder class Drupal\Tests\Core\Routing core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php Extends the core route builder with a setter method for the YAML discovery.
TestRouteProvider class Drupal\KernelTests\Core\Routing core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
TestRouteProvider class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php Provides a test entity route provider.
TestRouterInterface interface Drupal\Tests\Core\Routing core/tests/Drupal/Tests/Core/Routing/TestRouterInterface.php Provides a router interface that also can match requests.
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
TestRunnerKernel class Drupal\Core\Test core/lib/Drupal/Core/Test/TestRunnerKernel.php Defines a kernel used for running Functional tests and run-tests.sh.
TestRunResultsStorageInterface interface Drupal\Core\Test core/lib/Drupal/Core/Test/TestRunResultsStorageInterface.php Interface describing a test run results storage object. 1 1
TestRunTest class Drupal\KernelTests\Core\Test core/tests/Drupal/KernelTests/Core/Test/TestRunTest.php @coversDefaultClass \Drupal\Core\Test\TestRun[[api-linebreak]] @group Test
TestSearchPage class Drupal\Tests\search\Unit core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
TestSectionList class Drupal\Tests\layout_builder\Kernel core/modules/layout_builder/tests/src/Kernel/SectionListTraitTest.php
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 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 1
TestServiceComplexMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
TestServiceComplexMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceDecorator class Drupal\decorated_service_test core/modules/system/tests/modules/decorated_service_test/src/TestServiceDecorator.php 1 4
TestServiceMethodReturnsVoid class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceMethodWithParameter class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceNoMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
TestServiceNoMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceNullableTypeHintSelf class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceReturnReference class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceSimpleMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php

Other projects


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