You are here

public function InspectorTest::testAllCallable in Zircon Profile 8.0

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 154
Contains \Drupal\Tests\Component\Assertion\InspectorTest.

Class

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

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",
  ]));
}