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
TestInjection class Drupal\services_defaults_test core/modules/system/tests/modules/services_defaults_test/src/TestInjection.php A service that is injected via default autowiring. 2
TestInjection class Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestInjection.php A service that is autowired. 1 1
TestInjection2 class Drupal\services_defaults_test core/modules/system/tests/modules/services_defaults_test/src/TestInjection2.php A service that is injected via default autowiring.
TestInjection2 class Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestInjection2.php A service that is autowired. 1
TestInjection3 class Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestInjection3.php A service that is autowired. 1
TestInjectionInterface interface Drupal\services_defaults_test core/modules/system/tests/modules/services_defaults_test/src/TestInjectionInterface.php An interface for a service that is injected via default autowiring. 1
TestInjectionInterface interface Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestInjectionInterface.php An interface for a service that is autowired. 2
TestInlineTemplateFormBlock class Drupal\layout_builder_form_block_test\Plugin\Block core/modules/layout_builder/tests/modules/layout_builder_form_block_test/src/Plugin/Block/TestInlineTemplateFormBlock.php Provides a block containing inline template with <form> tag.
TestInstallStorage class Drupal\config_test core/modules/config/tests/config_test/src/TestInstallStorage.php Tests configuration of profiles, modules and themes. 1
TestInterface interface Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php 1
TestInterface interface Drupal\Tests\Core\DependencyInjection core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php A test interface for testing ContainerBuilder::__construct().
TestItem class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItem.php Defines the 'test_field' entity field item. 5
TestItemTest class Drupal\Tests\field\Kernel core/modules/field/tests/src/Kernel/TestItemTest.php Tests the new entity API for the test field type.
TestItemWithDependencies class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithDependencies.php Defines the 'test_field_with_dependencies' entity field item.
TestItemWithDependenciesTest class Drupal\Tests\field\Kernel core/modules/field/tests/src/Kernel/TestItemWithDependenciesTest.php Tests the new entity API for the test field with dependencies type.
TestItemWithMultipleDescriptions class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithMultipleDescriptions.php Defines the 'test_field_with_multiple_descriptions' entity field item.
TestItemWithPreconfiguredOptions class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithPreconfiguredOptions.php Defines the 'test_field_with_preconfigured_options' entity field item.
TestItemWithSingleDescription class Drupal\field_test\Plugin\Field\FieldType core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldType/TestItemWithSingleDescription.php Defines the 'test_field_with_single_description' entity field item.
TestKernel class Drupal\Core\Test core/lib/Drupal/Core/Test/TestKernel.php Kernel that is only used by mock front controllers. 7
TestLayoutContentFooter class Drupal\field_layout_test\Plugin\Layout core/modules/field_layout/tests/modules/field_layout_test/src/Plugin/Layout/TestLayoutContentFooter.php Provides a Layout plugin for field_layout tests.
TestLayoutEntityHelperTrait class Drupal\Tests\layout_builder\Kernel core/modules/layout_builder/tests/src/Kernel/LayoutEntityHelperTraitTest.php Test class using the trait.
TestLayoutMainFooter class Drupal\field_layout_test\Plugin\Layout core/modules/field_layout/tests/modules/field_layout_test/src/Plugin/Layout/TestLayoutMainFooter.php Provides an attributed layout plugin for field_layout tests.
TestLazyPluginCollection class Drupal\plugin_test\Plugin core/modules/system/tests/modules/plugin_test/src/Plugin/TestLazyPluginCollection.php Defines a plugin collection which uses fruit plugins.
TestLibraryDiscoveryParser class Drupal\Tests\Core\Asset core/tests/Drupal/Tests/Core/Asset/LibraryDiscoveryParserTest.php Wraps the tested class to mock the external dependencies.
TestLoader class Drupal\twig_loader_test\Loader core/modules/system/tests/modules/twig_loader_test/src/Loader/TestLoader.php A test Twig loader. 2
TestLocalAction class Drupal\menu_test\Plugin\Menu\LocalAction core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction.php Defines a test local action plugin class. 1
TestLocalAction4 class Drupal\menu_test\Plugin\Menu\LocalAction core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction4.php Defines a local action plugin with a dynamic title. 1
TestLocalAction5 class Drupal\menu_test\Plugin\Menu\LocalAction core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalAction/TestLocalAction5.php Defines a local action plugin with a dynamic title from user input. 1
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\http_kernel_test\HttpKernel core/modules/system/tests/modules/http_kernel_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
TestNodeVisitor final class Drupal\sdc_other_node_visitor\Twig\NodeVisitor core/modules/system/tests/modules/sdc_other_node_visitor/src/Twig/NodeVisitor/TestNodeVisitor.php A node visitor that adds nodes to the Twig template. 1
TestNormalizerBase abstract class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/NormalizerBaseTest.php Test class for NormalizerBase.

Other projects


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