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
TestRouteProvider class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php Provides a test entity route provider.
TestRouteProvider class Drupal\KernelTests\Core\Routing core/tests/Drupal/KernelTests/Core/Routing/RouteProviderTest.php Stub class for testing RouteProvider.
TestRouterInterface interface Drupal\Tests\Core\Routing core/tests/Drupal/Tests/Core/Routing/TestRouterInterface.php Provides a router interface that also can match requests. 2
TestRouteSubscriber class Drupal\Tests\views\Unit\EventSubscriber core/modules/views/tests/src/Unit/EventSubscriber/RouteSubscriberTest.php Provides a test route subscriber.
TestRouteSubscriber class Drupal\Tests\Core\Routing core/tests/Drupal/Tests/Core/Routing/RouteBuilderTest.php Provides a callback for route definition.
TestRun class Drupal\Core\Test core/lib/Drupal/Core/Test/TestRun.php Implements an object that tracks execution of a test run. 3
TestRunnerFinishedSubscriber final class Drupal\TestTools\Extension\HtmlLogging core/tests/Drupal/TestTools/Extension/HtmlLogging/TestRunnerFinishedSubscriber.php Event subscriber notifying end of test runner execution to HTML logging.
TestRunnerFinishedSubscriber final class Drupal\TestTools\Extension\Dump core/tests/Drupal/TestTools/Extension/Dump/TestRunnerFinishedSubscriber.php Event subscriber notifying end of test runner execution to HTML logging.
TestRunnerKernel class Drupal\Core\Test core/lib/Drupal/Core/Test/TestRunnerKernel.php Defines a kernel used for running Functional tests and run-tests.sh.
TestRunnerStartedSubscriber final class Drupal\TestTools\Extension\HtmlLogging core/tests/Drupal/TestTools/Extension/HtmlLogging/TestRunnerStartedSubscriber.php Event subscriber notifying beginning of test runner to HTML logging.
TestRunResultsStorageInterface interface Drupal\Core\Test core/lib/Drupal/Core/Test/TestRunResultsStorageInterface.php Interface describing a test run results storage object. 1 2
TestRunTest class Drupal\KernelTests\Core\Test core/tests/Drupal/KernelTests/Core/Test/TestRunTest.php Tests Drupal\Core\Test\TestRun.
TestSandboxDatabaseUpdatesValidator class Drupal\package_manager_test_validation core/modules/package_manager/tests/modules/package_manager_test_validation/src/TestSandboxDatabaseUpdatesValidator.php Allows tests to dictate which extensions have staged database updates.
TestSandboxManager class Drupal\Tests\package_manager\Kernel core/modules/package_manager/tests/src/Kernel/PackageManagerKernelTestBase.php Defines a stage specifically for testing purposes. 1
TestSearchPage class Drupal\Tests\search\Unit core/modules/search/tests/src/Unit/SearchPageRepositoryTest.php Mock for the configured search page entity.
TestSectionList class Drupal\Tests\layout_builder\Kernel core/modules/layout_builder/tests/src/Kernel/SectionListTraitTest.php Test item list class for layout section fields.
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\decorated_service_test core/modules/system/tests/modules/decorated_service_test/src/TestService.php A service class for handling test functionality. 1 3
TestService class Drupal\services_defaults_test core/modules/system/tests/modules/services_defaults_test/src/TestService.php An autowired service to test _defaults. 2
TestService class Drupal\autowire_test core/modules/system/tests/modules/autowire_test/src/TestService.php Service class for managing injected dependencies. 2
TestServiceComplexMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php Call used to test a service with a complex method.
TestServiceComplexMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with complex method.
TestServiceDecorator class Drupal\decorated_service_test core/modules/system/tests/modules/decorated_service_test/src/TestServiceDecorator.php Decorator for the TestService class. 1 4
TestServiceMethodReturnsVoid class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with void returning method.
TestServiceMethodWithParameter class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with method without parameter.
TestServiceNoMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service without methods.
TestServiceNoMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php Class used to test a service that has no methods.
TestServiceNullableTypeHintSelf class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with a nullable self parameter.
TestServiceReturnReference class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with method that returns reference.
TestServiceSimpleMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with simple method.
TestServiceWithChildInterfaces class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service that implements test child interface.
TestServiceWithInterface class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service that implements test interface.
TestServiceWithProtectedMethods class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with protected methods.
TestServiceWithPublicStaticMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php Test service with public static method.
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. 7 3
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\KernelTests\Scripts core/tests/Drupal/KernelTests/Scripts/TestSiteApplicationTest.php Tests core/scripts/test-site.php.
TestSiteClaroInstallTestScript class Drupal\TestSite core/tests/Drupal/TestSite/TestSiteClaroInstallTestScript.php Setup file used by TestSiteInstallTestScript.
TestSiteConfigurationExcluder class Drupal\Tests\package_manager\Kernel\PathExcluder core/modules/package_manager/tests/src/Kernel/PathExcluder/SiteConfigurationExcluderTest.php A test version of the site configuration excluder, to expose internals.
TestSiteExcluder final class Drupal\package_manager\PathExcluder core/modules/package_manager/src/PathExcluder/TestSiteExcluder.php Excludes 'sites/simpletest' from stage operations. 1
TestSiteExcluderTest class Drupal\Tests\package_manager\Kernel\PathExcluder core/modules/package_manager/tests/src/Kernel/PathExcluder/TestSiteExcluderTest.php Tests Site Excluder.
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.

Other projects


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