function InspectorTest::testAssertAllRegularExpressionMatch

Same name and namespace in other branches
  1. 11.x core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertAllRegularExpressionMatch()
  2. 10 core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertAllRegularExpressionMatch()
  3. 9 core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertAllRegularExpressionMatch()
  4. 8.9.x core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertAllRegularExpressionMatch()

Tests asserting regular expression match.

File

core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php, line 182

Class

InspectorTest
Tests Drupal\Component\Assertion\Inspector.

Namespace

Drupal\Tests\Component\Assertion

Code

public function testAssertAllRegularExpressionMatch() : void {
  $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,
  ]));
}

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