You are here

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

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

@covers ::assertAllStringable

File

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

Class

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

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