Types of tests: Writing tests All PHP-based tests for Drupal core are written using the industry-standard PHPUnit framework, with Drupal extensions. There are several categories of tests; each has its own purpose, base class, namespace, and directory: Unit tests: Purpose : Test functionality of a class if the Drupal environment (database, settings, etc.) and web browser are not needed for the test, or if the Drupal environment can be replaced by a "mock" object. Base class : \Drupal\Tests\UnitTestCase Namespace : \Drupal\Tests\yourmodule\Unit (or a subdirectory) Directory location : yourmodule/tests/src/Unit (or a subdirectory) Kernel tests: Purpose : Test functionality of a class if the full Drupal environment and web browser are not needed for the test, but the functionality has significant Drupal dependencies that cannot easily be mocked. Kernel tests can access services, the database, and a minimal mocked file system, and they use an in-memory pseudo-installation. Howe...
Trying to Learn new things on drupal.