function InspectorTest::testAssertAllStringable

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertAllStringable()
  2. 8.9.x core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertAllStringable()
  3. 10 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 60

Class

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

Namespace

Drupal\Tests\Component\Assertion

Code

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

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