function InspectorTest::testAssertStrictArray

Same name in other branches
  1. 9 core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertStrictArray()
  2. 8.9.x core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertStrictArray()
  3. 11.x core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php \Drupal\Tests\Component\Assertion\InspectorTest::testAssertStrictArray()

Tests asserting array is 0-indexed - the strict definition of array.

@covers ::assertStrictArray

File

core/tests/Drupal/Tests/Component/Assertion/InspectorTest.php, line 98

Class

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

Namespace

Drupal\Tests\Component\Assertion

Code

public function testAssertStrictArray() : void {
    $this->assertTrue(Inspector::assertStrictArray([]));
    $this->assertTrue(Inspector::assertStrictArray([
        'bar',
        'foo',
    ]));
    $this->assertFalse(Inspector::assertStrictArray([
        'foo' => 'bar',
        'bar' => 'foo',
    ]));
}

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