You are here

Classes, traits, and interfaces in Drupal 9

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

Namesort descending Type Namespace Location Description Direct uses Use statements Strings
TestSiteOliveroInstallTestScript class Drupal\TestSite core/tests/Drupal/TestSite/TestSiteOliveroInstallTestScript.php Setup file used by TestSiteInstallTestScript.
TestSiteReleaseLocksCommand class Drupal\TestSite\Commands core/tests/Drupal/TestSite/Commands/TestSiteReleaseLocksCommand.php Command to release all test site database prefix locks. 1
TestSiteTearDownCommand class Drupal\TestSite\Commands core/tests/Drupal/TestSite/Commands/TestSiteTearDownCommand.php Command to tear down a test Drupal site. 1
TestSiteUserLoginCommand class Drupal\TestSite\Commands core/tests/Drupal/TestSite/Commands/TestSiteUserLoginCommand.php Command to generate a login link for the test site. 1
TestSkipRowProcess class Drupal\migrate_prepare_row_test\Plugin\migrate\process core/modules/migrate/tests/modules/migrate_prepare_row_test/src/Plugin/migrate/process/TestSkipRowProcess.php Provides a testing process plugin that skips rows.
TestSqlBase class Drupal\Tests\migrate\Unit core/modules/migrate/tests/src/Unit/SqlBaseTest.php Creates a base source class for SQL migration testing.
TestSqlBase class Drupal\Tests\migrate\Kernel core/modules/migrate/tests/src/Kernel/SqlBaseTest.php A dummy source to help with testing SqlBase.
TestSqlIdMap class Drupal\Tests\migrate\Unit core/modules/migrate/tests/src/Unit/TestSqlIdMap.php Defines a SQL ID map for use in tests. 1 1
TestStateBasedSectionStorage class Drupal\layout_builder_test\Plugin\SectionStorage core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/SectionStorage/TestStateBasedSectionStorage.php Provides a test section storage that is controlled by state.
TestStatementInterface interface Drupal\Tests\views\Unit\Plugin\pager core/modules/views/tests/src/Unit/Plugin/pager/PagerPluginBaseTest.php As StatementInterface extends \Traversable, which though always needs an additional interface. The Statement class itself can't be mocked because of its __wakeup function.
TestStatus class Drupal\Core\Test core/lib/Drupal/Core/Test/TestStatus.php Consolidates test result status information. 1
TestStorage class Drupal\Tests\Core\Config core/tests/Drupal/Tests/Core/Config/StorageCopyTraitTest.php Provides a test implementation of \Drupal\Core\Config\StorageInterface.
TestSuiteBase abstract class Drupal\Tests\TestSuites core/tests/TestSuites/TestSuiteBase.php Base class for Drupal test suites. 6 1
TestSuiteBaseTest class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/TestSuiteBaseTest.php @coversDefaultClass \Drupal\Tests\TestSuites\TestSuiteBase
TestSystemLoggerChannel final class Drupal\advisory_feed_test core/modules/system/tests/modules/advisory_feed_test/src/TestSystemLoggerChannel.php Provides a decorator for the 'logger.channel.system' service for testing. 2
TestTasksSettingsSub1 class Drupal\menu_test\Plugin\Menu\LocalTask core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTasksSettingsSub1.php 1
TestTaskWithUserInput class Drupal\menu_test\Plugin\Menu\LocalTask core/modules/system/tests/modules/menu_test/src/Plugin/Menu/LocalTask/TestTaskWithUserInput.php 1
TestTestDatabase class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php Stub class supports TestDatabaseTest::testConstructorNullPrefix().
TestTextfieldWidget class Drupal\field_plugins_test\Plugin\Field\FieldWidget core/modules/field/tests/modules/field_plugins_test/src/Plugin/Field/FieldWidget/TestTextfieldWidget.php Plugin implementation of the 'field_plugins_test_text_widget' widget.
TestTextTrimmedFormatter class Drupal\field_plugins_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_plugins_test/src/Plugin/Field/FieldFormatter/TestTextTrimmedFormatter.php Plugin implementation of the 'field_plugins_test_text_formatter' formatter.
TestThemeEngineExtensionList class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php Test theme engine extension list class.
TestThemeExtensionList class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ThemeExtensionListTest.php Test theme extension list class.
TestThemeNegotiator class Drupal\menu_test\Theme core/modules/system/tests/modules/menu_test/src/Theme/TestThemeNegotiator.php Tests the theme negotiation functionality. 2
TestTime class Drupal\update_test\Datetime core/modules/update/tests/modules/update_test/src/Datetime/TestTime.php Test service for altering the request time. 2
TestToolkit class Drupal\image_test\Plugin\ImageToolkit core/modules/system/tests/modules/image_test/src/Plugin/ImageToolkit/TestToolkit.php Defines a Test toolkit for image manipulation within Drupal. 2
TestTrait trait Drupal\Tests\system\Traits core/modules/system/tests/src/Traits/TestTrait.php A nothing trait, but declared in the Drupal\Tests namespace. 1
TestTranslation class Drupal\media_test_source\Plugin\media\Source core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestTranslation.php Provides test media source.
TestTranslationManager class Drupal\Tests\user\Unit core/modules/user/tests/src/Unit/PermissionHandlerTest.php Implements a translation manager in tests.
TestTranslationManager class Drupal\Tests\Core\StringTranslation core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php
TestType class Drupal\workflow_type_test\Plugin\WorkflowType core/modules/workflows/tests/modules/workflow_type_test/src/Plugin/WorkflowType/TestType.php Test workflow type. 4
TestValidatedReferenceConstraint class Drupal\entity_test\Plugin\Validation\Constraint core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/TestValidatedReferenceConstraint.php Validates referenced entities.
TestValidatedReferenceConstraintValidator class Drupal\entity_test\Plugin\Validation\Constraint core/modules/system/tests/modules/entity_test/src/Plugin/Validation/Constraint/TestValidatedReferenceConstraintValidator.php Validates referenced entities.
TestVarDumper class Drupal\TestTools core/tests/Drupal/TestTools/TestVarDumper.php Provides handlers for the Symfony VarDumper to work within tests. 3
TestViewListBuilder class Drupal\Tests\views_ui\Unit core/modules/views_ui/tests/src/Unit/ViewListBuilderTest.php
TestViewsLocalTask class Drupal\Tests\views\Unit\Plugin\Derivative core/modules/views/tests/src/Unit/Plugin/Derivative/ViewsLocalTaskTest.php Replaces the applicable views call for easier testability.
TestViewsTest class Drupal\Tests\views\Kernel core/modules/views/tests/src/Kernel/TestViewsTest.php Tests that test views provided by all modules match schema.
TestWithConstraints class Drupal\media_test_source\Plugin\media\Source core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithConstraints.php Provides generic media type.
TestWithDispatcher class Drupal\Tests\Component\EventDispatcher core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php
TestWithHiddenSourceField class Drupal\media_test_source\Plugin\media\Source core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestWithHiddenSourceField.php Provides test media source.
TestWorkspaceNegotiator class Drupal\workspace_update_test\Negotiator core/modules/workspaces/tests/modules/workspace_update_test/src/Negotiator/TestWorkspaceNegotiator.php Defines a workspace negotiator used for testing. 2
TestXSSTitleBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestXSSTitleBlock.php Provides a block to test XSS in title.
Text class Drupal\views\Plugin\views\area core/modules/views/src/Plugin/views/area/Text.php Views area text handler.
Textarea class Drupal\Core\Render\Element core/lib/Drupal/Core/Render/Element/Textarea.php Provides a form element for input of multiple-line text. 1
Textarea class Drupal\config_translation\FormElement core/modules/config_translation/src/FormElement/Textarea.php Defines the textarea element for the configuration translation interface.
TextareaTest class Drupal\Tests\Core\Render\Element core/tests/Drupal/Tests/Core/Render/Element/TextareaTest.php @coversDefaultClass \Drupal\Core\Render\Element\Textarea @group Render
TextareaWidget class Drupal\text\Plugin\Field\FieldWidget core/modules/text/src/Plugin/Field/FieldWidget/TextareaWidget.php Plugin implementation of the 'text_textarea' widget. 1
TextareaWithSummaryTest class Drupal\Tests\text\FunctionalJavascript core/modules/text/tests/src/FunctionalJavascript/TextareaWithSummaryTest.php Tests the JavaScript functionality of the text_textarea_with_summary widget.
TextareaWithSummaryWidget class Drupal\text\Plugin\Field\FieldWidget core/modules/text/src/Plugin/Field/FieldWidget/TextareaWithSummaryWidget.php Plugin implementation of the 'text_textarea_with_summary' widget. 1
TextCustom class Drupal\views\Plugin\views\area core/modules/views/src/Plugin/views/area/TextCustom.php Views area text handler.
TextDefaultFormatter class Drupal\text\Plugin\Field\FieldFormatter core/modules/text/src/Plugin/Field/FieldFormatter/TextDefaultFormatter.php Plugin implementation of the 'text_default' formatter.

Pages

Other projects