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
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[[api-linebreak]] @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\decorated_service_test core/modules/system/tests/modules/decorated_service_test/src/TestService.php 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 1
TestServiceComplexMethod class Drupal\Tests\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceComplexMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/ProxyBuilder/ProxyBuilderTest.php
TestServiceDecorator class Drupal\decorated_service_test core/modules/system/tests/modules/decorated_service_test/src/TestServiceDecorator.php 1 4
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\Component\ProxyBuilder core/tests/Drupal/Tests/Component/ProxyBuilder/ProxyBuilderTest.php
TestServiceNoMethod class Drupal\Tests\Core\ProxyBuilder core/tests/Drupal/Tests/Core/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
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.
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\Kernel core/modules/migrate/tests/src/Kernel/SqlBaseTest.php A dummy source to help with testing SqlBase.
TestSqlBase class Drupal\Tests\migrate\Unit core/modules/migrate/tests/src/Unit/SqlBaseTest.php Creates a base source class for SQL migration testing.
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.
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 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

Other projects


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