You are here

public function InspectorTest::testAssertAllStringable 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::testAssertAllStringable()

Tests asserting all members are strings or objects with __toString().

@covers ::assertAllStringable

File

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

Class

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

Namespace

Drupal\Tests\Component\Assertion

Code

public function testAssertAllStringable() {
  $this
    ->assertTrue(Inspector::assertAllStringable([]));
  $this
    ->assertTrue(Inspector::assertAllStringable([
    'foo',
    'bar',
  ]));
  $this
    ->assertFalse(Inspector::assertAllStringable('foo'));
  $this
    ->assertTrue(Inspector::assertAllStringable([
    'foo',
    new StringObject(),
  ]));
}