Classes, traits, and interfaces - 9.5.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 1523

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
TestLocalActionManager class Drupal\Tests\Core\Menu core/tests/Drupal/Tests/Core/Menu/LocalActionManagerTest.php
TestLocalActionWithConfig class Drupal\menu_test\Plugin\Menu\LocalAction core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalActionWithConfig.php Defines a test local action plugin class. 1
TestLocalTaskController class Drupal\content_moderation_test_local_task\Controller core/modules/content_moderation/tests/modules/content_moderation_test_local_task/src/Controller/TestLocalTaskController.php A test controller.
TestLocalTaskDefault class Drupal\Tests\Core\Menu core/tests/Drupal/Tests/Core/Menu/LocalTaskDefaultTest.php
TestLog class Drupal\error_service_test\Logger core/modules/system/tests/modules/error_service_test/src/Logger/TestLog.php Throws an exception while logging an exception. 2
TestMailCollector class Drupal\Core\Mail\Plugin\Mail core/lib/Drupal/Core/Mail/Plugin/Mail/TestMailCollector.php Defines a mail backend that captures sent messages in the state system. 1 2
TestMailManager class Drupal\Tests\Core\Mail core/tests/Drupal/Tests/Core/Mail/MailManagerTest.php Provides a testing version of MailManager with an empty constructor.
TestMediaFilterController class Drupal\media_test_embed\Controller core/modules/media/tests/modules/media_test_embed/src/Controller/TestMediaFilterController.php Controller to allow testing of error handling of Media Embed in text editors.
TestMemoryBackend class Drupal\Tests\Core\Asset core/tests/Drupal/Tests/Core/Asset/AssetResolverTest.php
TestMiddleware class Drupal\httpkernel_test\HttpKernel core/modules/system/tests/modules/httpkernel_test/src/HttpKernel/TestMiddleware.php Provides a test middleware. 3
TestMigrateExecutable class Drupal\Tests\migrate\Unit core/modules/migrate/tests/src/Unit/TestMigrateExecutable.php Tests MigrateExecutable.
TestMigrateExecutable class Drupal\Tests\migrate\Kernel core/modules/migrate/tests/src/Kernel/TestMigrateExecutable.php Tests MigrateExecutable.
TestMigrateExecutable class Drupal\Tests\migrate\Kernel\Plugin core/modules/migrate/tests/src/Kernel/Plugin/LogTest.php MigrateExecutable test class.
TestMigration class Drupal\Tests\migrate\Unit core/modules/migrate/tests/src/Unit/MigrationTest.php Defines the TestMigration class.
TestMigrationConfigurationTrait class Drupal\Tests\migrate_drupal\Unit core/modules/migrate_drupal/tests/src/Unit/MigrationConfigurationTraitTest.php Test class that uses the trait we are testing.
TestMigrationMock class Drupal\Tests\migrate\Unit core/modules/migrate/tests/src/Unit/MigrationPluginManagerTest.php A mock migration plugin.
TestMultipleFormController class Drupal\block_test\Controller core/modules/block/tests/modules/block_test/src/Controller/TestMultipleFormController.php Controller for block_test module.
TestMultipleFormsBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestMultipleFormsBlock.php Provides a block with multiple forms.
TestMultiWidthLayoutsTest class Drupal\Tests\layout_builder\FunctionalJavascript core/modules/layout_builder/tests/src/FunctionalJavascript/TestMultiWidthLayoutsTest.php Test the multi-width layout plugins.
TestNodeFormOverride class Drupal\media_library_test\Form core/modules/media_library/tests/modules/media_library_test/src/Form/TestNodeFormOverride.php Override NodeForm to test media library form submission semantics. 1
TestNormalizerBase abstract class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php Test class for NormalizerBase.
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.
TestParser class Drupal\aggregator_test\Plugin\aggregator\parser core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/parser/TestParser.php Defines a Test parser implementation.
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
TestPluginBase class Drupal\Tests\views\Kernel\Plugin core/modules/views/tests/src/Kernel/Plugin/PluginBaseTest.php Helper class for using the PluginBase abstract class.
TestPluginDefinition class Drupal\KernelTests\Core\Plugin\Context core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginBaseTest.php
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.
TestProcessor class Drupal\aggregator_test\Plugin\aggregator\processor core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/processor/TestProcessor.php Defines a default processor implementation.
TestRequirementsTrait trait Drupal\Tests core/tests/Drupal/Tests/TestRequirementsTrait.php Allows test classes to require Drupal modules as dependencies. 1
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\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
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.

Other projects


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