You are here

public function InspectorTest::testAssertAllRegularExpressionMatch in Zircon Profile 8

Same name and namespace in other branches
  1. 8.0 core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertAllRegularExpressionMatch()

Tests asserting regular expression match.

@covers ::assertAllRegularExpressionMatch

File

core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php, line 214
Contains \Drupal\Tests\Component\Assertion\InspectorTest.

Class

InspectorTest
@coversDefaultClass \Drupal\Component\Assertion\Inspector @group Inspector

Namespace

Drupal\Tests\Component\Assertion

Code

public function testAssertAllRegularExpressionMatch() {
  $this
    ->assertTrue(Inspector::assertAllRegularExpressionMatch('/f/i', [
    'fee',
    'fi',
    'fo',
  ]));
  $this
    ->assertTrue(Inspector::assertAllRegularExpressionMatch('/F/i', [
    'fee',
    'fi',
    'fo',
  ]));
  $this
    ->assertTrue(Inspector::assertAllRegularExpressionMatch('/f/', [
    'fee',
    'fi',
    'fo',
  ]));
  $this
    ->assertFalse(Inspector::assertAllRegularExpressionMatch('/F/', [
    'fee',
    'fi',
    'fo',
  ]));
  $this
    ->assertFalse(Inspector::assertAllRegularExpressionMatch('/e/', [
    'fee',
    'fi',
    'fo',
  ]));
  $this
    ->assertFalse(Inspector::assertAllRegularExpressionMatch('/1/', [
    12,
  ]));
}