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
TestServiceWithChildInterfaces class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceWithInterface class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceWithProtectedMethods class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceWithPublicStaticMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestSessionBag class Drupal\session_test\Session core/modules/system/tests/modules/session_test/src/Session/TestSessionBag.php Test session container. 1 2
TestSessionHandlerProxy class Drupal\session_test\Session core/modules/system/tests/modules/session_test/src/Session/TestSessionHandlerProxy.php Provides a test session handler proxy. 3
TestSettingsValidationBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestSettingsValidationBlock.php Provides a test settings validation block.
TestSetupInterface interface Drupal\TestSite core/tests/Drupal/TestSite/TestSetupInterface.php Allows setting up an environment as part of a test site install. 4 1
TestSetupTrait trait Drupal\Core\Test core/lib/Drupal/Core/Test/TestSetupTrait.php Provides a trait for shared test setup functionality. 4
TestSetupTraitTest class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/TestSetupTraitTest.php Tests the TestSetupTrait trait.
TestSetupTraitTest class Drupal\KernelTests\Core\Test core/tests/Drupal/KernelTests/Core/Test/TestSetupTraitTest.php Tests the TestSetupTrait trait.
TestSiteApplication class Drupal\TestSite core/tests/Drupal/TestSite/TestSiteApplication.php Application wrapper for test site commands. 1
TestSiteApplicationTest class Drupal\Tests\Scripts core/tests/Drupal/Tests/Scripts/TestSiteApplicationTest.php Tests core/scripts/test-site.php.
TestSiteClaroInstallTestScript class Drupal\TestSite core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php Setup file used by TestSiteInstallTestScript.
TestSiteInstallCommand class Drupal\TestSite\Commands core/tests/Drupal/TestSite/Commands/TestSiteInstallCommand.php Command to create a test Drupal site. 1
TestSiteInstallTestScript class Drupal\TestSite core/tests/Drupal/TestSite/TestSiteInstallTestScript.php Setup file used by TestSiteApplicationTest.
TestSiteMultilingualInstallTestScript class Drupal\TestSite core/tests/Drupal/TestSite/TestSiteMultilingualInstallTestScript.php Setup file used by TestSiteApplicationTest.
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.
TestSqlContentDefaultTableMapping class Drupal\Tests\Core\Entity\Sql core/tests/Drupal/Tests/Core/Entity/Sql/SqlContentEntityStorageSchemaTest.php Extends DefaultTableMapping to allow calling its protected methods.
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 Creates StatementInterface for testing.
TestStaticMethodClass class Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php
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

in drupal:10.3.0 and is removed from drupal:11.0.0. There is no replacement and test discovery will be handled differently in PHPUnit 10.

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[[api-linebreak]]
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 Defines a local task plugin with a dynamic title. 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\Core\StringTranslation core/tests/Drupal/Tests/Core/StringTranslation/TranslationManagerTest.php
TestTranslationManager class Drupal\Tests\user\Unit core/modules/user/tests/src/Unit/PermissionHandlerTest.php Implements a translation manager in tests.
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
TestUrl class Drupal\Tests\Core core/tests/Drupal/Tests/Core/UrlTest.php

Other projects


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