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
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\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
TestPluginManager class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/TestPluginManager.php A plugin manager for condition plugins. 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 An event subscriber to test altering section storage via the \Drupal\layout_builder\Event\PrepareLayoutEvent. 2
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
TestRouteProvider class Drupal\KernelTests\Core\Routing core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php
TestRouteProvider class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php Provides a test entity route provider.
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\views\Unit\EventSubscriber core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php Provides a test route subscriber.
TestRunnerKernel class Drupal\Core\Test core/lib/Drupal/Core/Test/TestRunnerKernel.php Kernel for run-tests.sh. 2
TestRunnerKernelTest class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/TestRunnerKernelTest.php @coversDefaultClass \Drupal\Core\Test\TestRunnerKernel @runTestsInSeparateProcesses @preserveGlobalState disabled @group Test @group simpletest
TestSearchPage class Drupal\Tests\search\Unit core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php
TestSectionList class Drupal\Tests\layout_builder\Kernel core/modules/layout_builder/tests/src/Kernel/SectionListTraitTest.php
TestSelection class Drupal\block_content_test\Plugin\EntityReferenceSelection core/modules/block_content/tests/modules/block_content_test/src/Plugin/EntityReferenceSelection/TestSelection.php Test EntityReferenceSelection with conditions on the 'reusable' field. 1
TestService class Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestService.php 1
TestServiceComplexMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
TestServiceComplexMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceMethodReturnsVoid class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceMethodWithParameter class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceNoMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
TestServiceNoMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceNullableTypehintSelf class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceReturnReference class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceSimpleMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
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
TestSettingSummariesContentType class Drupal\Tests\node\FunctionalJavascript core/modules/node/tests/src/FunctionalJavascript/TestSettingSummariesContentType.php Tests the JavaScript updating of summaries on content type form.
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. 3 1
TestSetupTrait trait Drupal\Core\Test core/lib/Drupal/Core/Test/TestSetupTrait.php Provides a trait for shared test setup functionality. 3
TestSetupTraitTest class Drupal\Tests\Core\Test core/tests/Drupal/Tests/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.
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.

Pages

Other projects