public function testMatchesArrayContainingKeyWithNumberKeys()
 {
     $array = array(1 => 'A', 2 => 'B');
     assertThat($array, hasKey(1));
     // very ugly version!
     assertThat($array, Hamcrest_Array_IsArrayContainingKey::hasKeyInArray(2));
 }
Esempio n. 2
0
/**
 * Evaluates to true if any key in an array matches the given matcher.
 * 
 * @param mixed $key as a {@link Hamcrest_Matcher} or a value.
 */
function hasKey($key)
{
    require_once 'Hamcrest/Array/IsArrayContainingKey.php';
    return Hamcrest_Array_IsArrayContainingKey::hasKeyInArray($key);
}