Classes, traits, and interfaces - main - 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 1529

Name Deprecated Object type Namespace File name Summary Direct uses Use statements Strings
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 The TestContextAwareLayout Class.
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 Context aware plugin test class.
TestContextAwarePluginDefinition class Drupal\KernelTests\Core\Plugin\Context core/tests/Drupal/KernelTests/Core/Plugin/Context/ContextAwarePluginTraitTest.php A plugin definition test class.
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\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 Controller for testing module information and container reset functionality.
TestController class Drupal\path_changed_helper_test\Controller core/modules/system/tests/modules/path_changed_helper_test/src/Controller/TestController.php Controller for testing the PathChangedHelper class.
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\http_kernel_test\Controller core/modules/system/tests/modules/http_kernel_test/src/Controller/TestController.php A test controller.
TestController class Drupal\jswebassert_test\Controller core/modules/system/tests/modules/jswebassert_test/src/Controller/TestController.php Provides a test page for JavaScript assertions.
TestController class Drupal\content_negotiation_test\Controller core/modules/system/tests/modules/content_negotiation_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\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.
TestController class Drupal\views_test_modal\Controller core/modules/views/tests/modules/views_test_modal/src/Controller/TestController.php Controller for testing page that renders a View in a modal.
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\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 Controller for testing custom access.
TestController class Drupal\package_manager_test_release_history core/modules/package_manager/tests/modules/package_manager_test_release_history/src/TestController.php Controller for generating mock XML metadata for package manager testing.
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
TestCoverageTest class Drupal\Tests\jsonapi\Kernel core/modules/jsonapi/tests/src/Kernel/TestCoverageTest.php Checks that all core content/config entity types have JSON:API test coverage.
TestDatabase class Drupal\Core\Test core/lib/Drupal/Core/Test/TestDatabase.php Provides helper methods for interacting with the fixture database. 1 10
TestDatabaseTest class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/TestDatabaseTest.php Tests Drupal\Core\Test\TestDatabase.
TestDataType class Drupal\Tests\Core\Plugin\Fixtures\Plugin\DataType core/tests/Drupal/Tests/Core/Plugin/Fixtures/Plugin/DataType/TestDataType.php Provides a test data type.
TestDataTypeDeriver class Drupal\Tests\Core\Plugin\Fixtures\Plugin\DataType core/tests/Drupal/Tests/Core/Plugin/Fixtures/Plugin/DataType/TestDataTypeDeriver.php Provides a deriver that returns a plugin for the bare ID and one variant.
TestDefaultExceptionSubscriber class Drupal\Tests\Core\EventSubscriber core/tests/Drupal/Tests/Core/EventSubscriber/FinalExceptionSubscriberTest.php Test class for testing the final exception subscriber.
TestDefaultHtmlRouteProvider class Drupal\Tests\Core\Entity\Routing core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php Stub class for testing DefaultHtmlRouteProvider.
TestDefaultTableMapping class Drupal\Tests\Core\Entity\Sql core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php Extends DefaultTableMapping to allow calling its protected methods.
TestDeprecatedSuggestionThemeHooks class Drupal\test_deprecated_suggestion_theme\Hook core/modules/system/tests/themes/test_deprecated_suggestion_theme/src/Hook/TestDeprecatedSuggestionThemeHooks.php Hook implementations for test_deprecated_suggestion_theme.
TestDerivativeDiscovery class Drupal\Tests\Core\Plugin\Discovery core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscovery.php Defines test derivative discovery. 1
TestDerivativeDiscoveryWithObject class Drupal\Tests\Core\Plugin\Discovery core/tests/Drupal/Tests/Core/Plugin/Discovery/TestDerivativeDiscoveryWithObject.php Defines test derivative discovery using an object.
TestDifferentDisplays class Drupal\media_test_source\Plugin\media\Source core/modules/media/tests/modules/media_test_source/src/Plugin/media/Source/TestDifferentDisplays.php Provides test media source.
TestDirectWriteSandboxManager class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php Defines a test-only sandbox manager that allows direct-write.
TestDiscovery class Drupal\Core\Test core/lib/Drupal/Core/Test/TestDiscovery.php Discovers available tests. 2
TestDiscoveryTest class Drupal\Tests\Core\Test core/tests/Drupal/Tests/Core/Test/TestDiscoveryTest.php Unit tests for test discovery.
TestDiskSpaceValidator class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php A test version of the disk space validator to bypass system-level functions.
TestDisplayVariant class Drupal\display_variant_test\Plugin\DisplayVariant core/modules/system/tests/modules/display_variant_test/src/Plugin/DisplayVariant/TestDisplayVariant.php Provides a display variant that requires configuration.
TestDomainObject class Drupal\early_rendering_controller_test core/modules/system/tests/modules/early_rendering_controller_test/src/TestDomainObject.php Test domain class. 2
TestDomainObjectViewSubscriber class Drupal\early_rendering_controller_test core/modules/system/tests/modules/early_rendering_controller_test/src/TestDomainObjectViewSubscriber.php View subscriber for turning TestDomainObject objects into Response objects. 2
TestDrupal6SqlBase class Drupal\Tests\migrate_drupal\Unit\source\d6 core/modules/migrate_drupal/tests/src/Unit/source/d6/Drupal6SqlBaseTest.php Extends the Drupal6SqlBase abstract class.
TestDrupalSqlBase class Drupal\Tests\migrate_drupal\Unit\source core/modules/migrate_drupal/tests/src/Unit/source/DrupalSqlBaseTest.php Extends the DrupalSqlBase abstract class.

Other projects


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