function StatusCommandTest::assertStringContainsStringNoWhitespace
Same name and namespace in other branches
- 11.x core/modules/system/tests/src/Kernel/Command/StatusCommandTest.php \Drupal\Tests\system\Kernel\Command\StatusCommandTest::assertStringContainsStringNoWhitespace()
Asserts that a string contains another string ignoring whitespace.
Parameters
string $needle: The string we're looking for.
string $haystack: The string we're looking in.
string|null $message: Optional custom assertion message.
File
-
core/
modules/ system/ tests/ src/ Kernel/ Command/ StatusCommandTest.php, line 98
Class
- StatusCommandTest
- Tests the 'system:status' command.
Namespace
Drupal\Tests\system\Kernel\CommandCode
protected function assertStringContainsStringNoWhitespace(string $needle, string $haystack, ?string $message = NULL) : void {
$normalized_needle = preg_replace('/\\s+/', ' ', trim($needle));
$normalized_haystack = preg_replace('/\\s+/', ' ', trim($haystack));
$this->assertStringContainsString($normalized_needle, $normalized_haystack, $message ?? '');
}
Buggy or inaccurate documentation? Please file an issue. Need support? Need help programming? Connect with the Drupal community.