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
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 @coversDefaultClass \Drupal\Core\Test\TestDatabase[[api-linebreak]]
TestDataConverter class Drupal\rdf_test core/modules/rdf/tests/rdf_test/src/TestDataConverter.php Contains methods for test data conversions.
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
TestDefaultHtmlRouteProvider class Drupal\Tests\Core\Entity\Routing core/tests/Drupal/Tests/Core/Entity/Routing/DefaultHtmlRouteProviderTest.php
TestDefaultTableMapping class Drupal\Tests\Core\Entity\Sql core/tests/Drupal/Tests/Core/Entity/Sql/DefaultTableMappingTest.php Extends DefaultTableMapping to allow calling its protected methods.
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.
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 @coversDefaultClass \Drupal\Core\Test\TestDiscovery[[api-linebreak]] @group Test
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 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.
TestElementInfoManager class Drupal\Tests\Core\Render core/tests/Drupal/Tests/Core/Render/ElementInfoManagerTest.php Provides a test custom element plugin.
TestEntityFieldManager class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityFieldManagerTest.php
TestEntityForm class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php Provides a test entity form. 1
TestEntityFormInjected class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php Provides a test entity form that uses injection.
TestEntityHandlerBase abstract class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php Provides a test entity handler.
TestEntityListBuilder class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityListBuilderTest.php
TestEntityType class Drupal\Tests\views\Kernel\Entity core/modules/views/tests/src/Kernel/Entity/EntityViewsDataTest.php Entity type class which allows changing the entity keys.
TestEntityTypeManager class Drupal\Tests\Core\Entity core/tests/Drupal/Tests/Core/Entity/EntityTypeManagerTest.php Provides a test entity type manager.
TestEventListener class Drupal\Tests\Component\EventDispatcher core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php
TestEventSubscriber class Drupal\Tests\Component\EventDispatcher core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php
TestEventSubscriberWithMultipleListeners class Drupal\Tests\Component\EventDispatcher core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php
TestEventSubscriberWithPriorities class Drupal\Tests\Component\EventDispatcher core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php
TestExample class Drupal\views_test_data\Plugin\views\area core/modules/views/tests/modules/views_test_data/src/Plugin/views/area/TestExample.php Test area plugin.
TestExtendedNormalizer class Drupal\Tests\serialization\Unit\Normalizer core/modules/serialization/tests/src/Unit/Normalizer/ComplexDataNormalizerTest.php Test normalizer with a different supported class.
TestExtension class Drupal\twig_extension_test\TwigExtension core/modules/system/tests/modules/twig_extension_test/src/TwigExtension/TestExtension.php A test Twig extension that adds a custom function and a custom filter. 1 2
TestExtension class Drupal\Tests\Core\Extension core/tests/Drupal/Tests/Core/Extension/ExtensionListTest.php
TestFetcher class Drupal\aggregator_test\Plugin\aggregator\fetcher core/modules/aggregator/tests/modules/aggregator_test/src/Plugin/aggregator/fetcher/TestFetcher.php Defines a test fetcher implementation.
TestFieldApplicableFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldApplicableFormatter.php Plugin implementation of the 'field_test_applicable' formatter.
TestFieldConstraint class Drupal\field_test\Plugin\Validation\Constraint core/modules/field/tests/modules/field_test/src/Plugin/Validation/Constraint/TestFieldConstraint.php Checks if a value is not equal.
TestFieldDefaultFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldDefaultFormatter.php Plugin implementation of the 'field_test_default' formatter.
TestFieldEmptyFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptyFormatter.php Plugin implementation of the 'field_empty_test' formatter.
TestFieldEmptySettingFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldEmptySettingFormatter.php Plugin implementation of the 'field_empty_setting' formatter.
TestFieldMultipleFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldMultipleFormatter.php Plugin implementation of the 'field_test_multiple' formatter.
TestFieldNoSettingsFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldNoSettingsFormatter.php Plugin implementation of the 'field_no_settings' formatter.
TestFieldPrepareViewFormatter class Drupal\field_test\Plugin\Field\FieldFormatter core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldFormatter/TestFieldPrepareViewFormatter.php Plugin implementation of the 'field_test_with_prepare_view' formatter.
TestFieldType class Drupal\Tests\field\Unit core/modules/field/tests/src/Unit/FieldStorageConfigEntityUnitTest.php A test class to test field storage dependencies.
TestFieldWidget class Drupal\field_test\Plugin\Field\FieldWidget core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidget.php Plugin implementation of the 'test_field_widget' widget. 1
TestFieldWidgetMultilingual class Drupal\field_test\Plugin\Field\FieldWidget core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultilingual.php Plugin implementation of the 'test_field_widget_multilingual' widget.
TestFieldWidgetMultiple class Drupal\field_test\Plugin\Field\FieldWidget core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultiple.php Plugin implementation of the 'test_field_widget_multiple' widget. 1
TestFieldWidgetMultipleSingleValues class Drupal\field_test\Plugin\Field\FieldWidget core/modules/field/tests/modules/field_test/src/Plugin/Field/FieldWidget/TestFieldWidgetMultipleSingleValues.php Plugin implementation of the 'test_field_widget_multiple' widget.
TestFileCopy class Drupal\Tests\migrate\Unit\process core/modules/migrate/tests/src/Unit/process/FileCopyTest.php Class for testing FileCopy.

Other projects


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