1.20.x common.test CommonBackdropArrayUnitTest::testKeyExists()

Tests existence of array key.

File

modules/simpletest/tests/common.test, line 3061
Tests for common.inc functionality.

Class

CommonBackdropArrayUnitTest
Tests the various backdrop_array_* helper functions.

Code

function testKeyExists() {
  // Verify that existing key is found.
  $this->assertIdentical(backdrop_array_nested_key_exists($this->form, $this->parents), TRUE, 'Nested key found.');

  // Verify that non-existing keys are not found.
  $parents = $this->parents;
  $parents[] = 'foo';
  $this->assertIdentical(backdrop_array_nested_key_exists($this->form, $parents), FALSE, 'Non-existing nested key not found.');
}