You are here

public function InspectorTest::testAllCallable in Drupal 9

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

Tests asserting all members are callable.

@covers ::assertAllCallable

File

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

Class

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

Namespace

Drupal\Tests\Component\Assertion

Code

public function testAllCallable() {
  $this
    ->assertTrue(Inspector::assertAllCallable([
    'strchr',
    [
      $this,
      'callMe',
    ],
    [
      __CLASS__,
      'callMeStatic',
    ],
    function () {
      return TRUE;
    },
  ]));
  $this
    ->assertFalse(Inspector::assertAllCallable([
    'strchr',
    [
      $this,
      'callMe',
    ],
    [
      __CLASS__,
      'callMeStatic',
    ],
    function () {
      return TRUE;
    },
    "I'm not callable",
  ]));
}