mglaman / drupal-test-helpers
Helpers for writing better Kernel and Unit tests for Drupal
1.0.2
2023-06-02 04:48 UTC
Requires
- php: ^8.1
- drupal/core: ^9 || ^10
- phpstan/phpstan-phpunit: ^1.1
Requires (Dev)
- ergebnis/composer-normalize: ^2.28
- mikey179/vfsstream: ^1.6
- phpspec/prophecy-phpunit: ^2
- phpstan/extension-installer: ^1.1
- phpstan/phpstan: ^1.8
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.7
- symfony/css-selector: ^6.2
- symfony/phpunit-bridge: ^6.1
README
Helpers for writing better Kernel and Unit tests for Drupal
Traits
The following traits are provided by this library for tests
RequestTrait
Provides methods to assert requests and responses within Kernel tests.
final class RequestTraitTest extends KernelTestBase { use RequestTrait; /** * @var string[] */ protected static $modules = ['system', 'user']; public function testDoRequest(): void { $this->installConfig(['system']); $this->doRequest(Request::create('/user/login')); self::assertStringContainsString( 'Enter your username.', $this->getRawContent() ); } }