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
TestFileCreationTrait trait Drupal\Tests core/tests/Drupal/Tests/TestFileCreationTrait.php Provides methods to create test files from given values. 64
TestFileParser class Drupal\Core\Test\RunTests core/lib/Drupal/Core/Test/RunTests/TestFileParser.php Parses class names from PHP files without loading them. 1
TestFileParserTest class Drupal\Tests\Core\Test\RunTests core/tests/Drupal/Tests/Core/Test/RunTests/TestFileParserTest.php @coversDefaultClass \Drupal\Core\Test\RunTests\TestFileParser[[api-linebreak]] @group Test @group RunTests
TestFileTransfer class Drupal\Tests\system\Functional\FileTransfer core/modules/system/tests/src/Functional/FileTransfer/TestFileTransfer.php Mock FileTransfer object for test case.
TestFileTransferWithSettingsForm class Drupal\update_test core/modules/update/tests/modules/update_test/src/TestFileTransferWithSettingsForm.php Provides an object to test the settings form functionality.
TestFileUsage class Drupal\service_provider_test core/modules/system/tests/modules/service_provider_test/src/TestFileUsage.php
TestFilteredPluginManager class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/FilteredPluginManagerTraitTest.php Class that allows testing the trait.
TestFilterIterator class Drupal\Tests\migrate\Kernel core/modules/migrate/tests/src/Kernel/TestFilterIterator.php Class to test FilterIterators.
TestForm class Drupal\test_page_test\Form core/modules/system/tests/modules/test_page_test/src/Form/TestForm.php Defines a test form for testing assertions. 1
TestForm class Drupal\block_test\Form core/modules/block/tests/modules/block_test/src/Form/TestForm.php Form that performs base block form test.
TestForm class Drupal\page_cache_form_test\Form core/modules/page_cache/tests/modules/src/Form/TestForm.php A form to test page cache. 1
TestForm class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php 2
TestFormApiFormBlock class Drupal\layout_builder_form_block_test\Plugin\Block core/modules/layout_builder/tests/modules/layout_builder_form_block_test/src/Plugin/Block/TestFormApiFormBlock.php Provides a block containing a Form API form for use in Layout Builder tests.
TestFormBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestFormBlock.php Provides a block to test caching.
TestFormInjected class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
TestFormWithPredefinedForm class Drupal\Tests\Core\Form core/tests/Drupal/Tests/Core/Form/FormBuilderTest.php
TestHandler class Drupal\Tests\views\Unit\Plugin core/modules/views/tests/src/Unit/Plugin/HandlerBaseTest.php Allow testing base handler implementation by extending the abstract class.
TestHelperPlugin class Drupal\views\Tests core/modules/views/src/Tests/TestHelperPlugin.php Wraps the plugin base class to be able to instantiate it. 1
TestHelpSection class Drupal\help_topics_test\Plugin\HelpSection core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/HelpSection/TestHelpSection.php Provides a searchable help section for testing.
TestHelpTopicDeriver class Drupal\help_topics_test\Plugin\Deriver core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/Deriver/TestHelpTopicDeriver.php A test discovery deriver for fake help topics. 1
TestHelpTopicPlugin class Drupal\help_topics_test\Plugin\HelpTopic core/modules/help_topics/tests/modules/help_topics_test/src/Plugin/HelpTopic/TestHelpTopicPlugin.php A fake help topic plugin for testing. 1
TestHtmlBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestHtmlBlock.php Provides a block to test HTML. 1
TestHtmlMailCollector class Drupal\mail_html_test\Plugin\Mail core/modules/system/tests/modules/mail_html_test/src/Plugin/Mail/TestHtmlMailCollector.php Defines a mail backend that captures sent HTML messages in the state system.
TestHttpClientMiddleware class Drupal\Core\Test\HttpClientMiddleware core/lib/Drupal/Core/Test/HttpClientMiddleware/TestHttpClientMiddleware.php Overrides the User-Agent HTTP header for outbound HTTP requests. 1
TestingProfileInstallTest class Drupal\FunctionalTests\Installer core/tests/Drupal/FunctionalTests/Installer/TestingProfileInstallTest.php Tests installing the Testing profile with update notifications on.
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\autowire_test core/modules/system/tests/modules/autowire_test/src/TestInjection2.php A service that is autowired. 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.
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. 1
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. 2
TestInterface interface Drupal\Tests\Core\DependencyInjection core/tests/Drupal/Tests/Core/DependencyInjection/ContainerBuilderTest.php A test interface for testing ContainerBuilder::__construct().
TestInterface interface Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php 1
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. 3
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.
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.
TestKernel class Drupal\Core\Test core/lib/Drupal/Core/Test/TestKernel.php Kernel to mock requests to test simpletest. 7
TestLayoutContentFooter class Drupal\field_layout_test\Plugin\Layout core/modules/field_layout/tests/modules/field_layout_test/src/Plugin/Layout/TestLayoutContentFooter.php Provides an annotated 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 annotated 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

Other projects


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