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
TestBaseInterface interface Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php 1
TestBlockInstantiation class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestBlockInstantiation.php Provides a basic block for testing block instantiation and configuration. 1
TestBlockPluginWithRefinableDependentAccessInterface interface Drupal\Tests\layout_builder\Unit core/modules/layout_builder/tests/src/Unit/BlockComponentRenderArrayTest.php Test interface for dependent access block plugins.
TestCacheableDependency class Drupal\Tests\Core\Render core/tests/Drupal/Tests/Core/Render/TestCacheableDependency.php Cacheable dependency object for use in tests. 1
TestCacheBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestCacheBlock.php Provides a block to test caching. 1
TestCallables class Drupal\Tests\Core\Render core/tests/Drupal/Tests/Core/Render/RendererTest.php
TestChildInterface interface Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php 1
TestClass class Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/PluginWithFormsTraitTest.php
TestClass class Drupal\Tests\Component\Utility core/tests/Drupal/Tests/Component/Utility/ArgumentsResolverTest.php Provides a test class.
TestClass class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/AssertContentTraitTest.php
TestClass class Drupal\service_provider_test core/modules/system/tests/modules/service_provider_test/src/TestClass.php 2
TestClass class Drupal\Tests\layout_builder\Unit core/modules/layout_builder/tests/src/Unit/LayoutEntityHelperTraitTest.php Test class using the trait.
TestCompatibilityTrait trait Drupal\TestTools\PhpUnitCompatibility\PhpUnit8 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit8/TestCompatibilityTrait.php Drupal's forward compatibility layer with multiple versions of PHPUnit.
TestCompatibilityTrait trait Drupal\TestTools\PhpUnitCompatibility\PhpUnit9 core/tests/Drupal/TestTools/PhpUnitCompatibility/PhpUnit9/TestCompatibilityTrait.php Drupal's forward compatibility layer with multiple versions of PHPUnit.
TestConcat class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/ConcatTest.php
TestConditionAccessResolverTrait class Drupal\Tests\Core\Condition core/tests/Drupal/Tests/Core/Condition/ConditionAccessResolverTraitTest.php
TestConfigEntityWithPluginCollections class Drupal\Tests\Core\Config\Entity core/tests/Drupal/Tests/Core/Config/Entity/ConfigEntityBaseUnitTest.php
TestConfigFactoryOverrideBase class Drupal\Tests\Core\Config core/tests/Drupal/Tests/Core/Config/ConfigFactoryOverrideBaseTest.php
TestConfigNamesMapper class Drupal\Tests\config_translation\Unit core/modules/config_translation/tests/src/Unit/ConfigNamesMapperTest.php Defines a test mapper class.
TestConfigType class Drupal\module_installer_config_test\Entity core/modules/system/tests/modules/module_installer_config_test/src/Entity/TestConfigType.php Defines a configuration-based entity type used for testing.
TestConfigurableContextAwarePlugin class Drupal\KernelTests\Core\Plugin\Context core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php
TestConfigurableContextAwarePluginInterface interface Drupal\Tests\Core\Plugin core/tests/Drupal/Tests/Core/Plugin/ContextHandlerTest.php
TestConfigurablePlugin class Drupal\Tests\Core\Plugin\Fixtures core/tests/Drupal/Tests/Core/Plugin/Fixtures/TestConfigurablePlugin.php 3
TestContainerDerivativeDiscovery class Drupal\Tests\Core\Plugin\Discovery core/tests/Drupal/Tests/Core/Plugin/Discovery/TestContainerDerivativeDiscovery.php Defines container test derivative discovery.
TestContent class Drupal\router_test core/modules/system/tests/modules/router_test_directory/src/TestContent.php Test controllers that are intended to be wrapped in a main controller.
TestContextAwareBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareBlock.php Provides a context-aware block.
TestContextAwareLayout class Drupal\layout_builder_test\Plugin\Layout core/modules/layout_builder/tests/modules/layout_builder_test/src/Plugin/Layout/TestContextAwareLayout.php Plugin annotation @Layout( id = "layout_builder_test_context_aware", label = @Translation("Layout Builder Test: Context Aware"), regions = { "main" = { "label" = @Translation("Main Region") } }, context_definitions = { …
TestContextAwareNoValidContextOptionsBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareNoValidContextOptionsBlock.php Provides a context-aware block that uses a not-passed, non-required context.
TestContextAwarePlugin class Drupal\KernelTests\Core\Plugin core/tests/Drupal/KernelTests/Core/Plugin/ContextHandlerTest.php Provides a test implementation of a context-aware plugin.
TestContextAwarePlugin class Drupal\KernelTests\Core\Plugin\Context core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php
TestContextAwarePluginDefinition class Drupal\KernelTests\Core\Plugin\Context core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php
TestContextAwareUnsatisfiedBlock class Drupal\block_test\Plugin\Block core/modules/block/tests/modules/block_test/src/Plugin/Block/TestContextAwareUnsatisfiedBlock.php Provides a context-aware block.
TestContextualLink class Drupal\menu_test\Plugin\Menu\ContextualLink core/modules/system/tests/modules/menu_test/src/Plugin/Menu/ContextualLink/TestContextualLink.php Defines a contextual link plugin with a dynamic title from user input. 1
TestController class Drupal\httpkernel_test\Controller core/modules/system/tests/modules/httpkernel_test/src/Controller/TestController.php A test controller.
TestController class Drupal\token_test\Controller core/modules/system/tests/modules/token_test/src/Controller/TestController.php Provides a test controller for token replacement.
TestController class Drupal\container_rebuild_test core/modules/system/tests/modules/container_rebuild_test/src/TestController.php
TestController class Drupal\conneg_test\Controller core/modules/system/tests/modules/conneg_test/src/Controller/TestController.php Test controller for content negotiation tests.
TestController class Drupal\dialog_renderer_test\Controller core/modules/system/tests/modules/dialog_renderer_test/src/Controller/TestController.php Test controller display modal links and content.
TestController class Drupal\off_canvas_test\Controller core/modules/system/tests/modules/off_canvas_test/src/Controller/TestController.php Test controller for 2 different responses.
TestController class Drupal\csrf_test\Controller core/modules/system/tests/modules/csrf_test/src/Controller/TestController.php Just a test controller for test routes.
TestController class Drupal\js_webassert_test\Controller core/modules/system/tests/modules/js_webassert_test/src/Controller/TestController.php
TestController class Drupal\contextual_test\Controller core/modules/contextual/tests/modules/contextual_test/src/Controller/TestController.php Test controller to provide a callback for the contextual link.
TestController class Drupal\views_test_modal\Controller core/modules/views/tests/modules/views_test_modal/src/Controller/TestController.php
TestController class Drupal\csrf_race_test\Controller core/modules/system/tests/modules/csrf_race_test/src/Controller/TestController.php Controller to test concurrent CSRF token generation.
TestController class Drupal\Tests\Core\Controller core/tests/Drupal/Tests/Core/Controller/TestController.php Defines a test controller used by unit tests.
TestController class Drupal\Tests\Core\Access core/tests/Drupal/Tests/Core/Access/CustomAccessCheckTest.php
TestController class Drupal\Tests\views\Unit\Plugin\display core/modules/views/tests/src/Unit/Plugin/display/PathPluginBaseTest.php A page controller for use by tests in this file.
TestControllers class Drupal\paramconverter_test core/modules/system/tests/modules/paramconverter_test/src/TestControllers.php Controller routine for testing the paramconverter.
TestControllers class Drupal\menu_test core/modules/system/tests/modules/menu_test/src/TestControllers.php Controllers for testing the menu integration routing system.
TestControllers class Drupal\router_test core/modules/system/tests/modules/router_test_directory/src/TestControllers.php Controller routines for testing the routing system. 1

Other projects


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