diff --git a/src/IsAssocArray.php b/src/IsAssocArray.php new file mode 100644 index 000000000..27e29a139 --- /dev/null +++ b/src/IsAssocArray.php @@ -0,0 +1,26 @@ + 0 + ); + } +} diff --git a/test/IsAssocArrayTest.php b/test/IsAssocArrayTest.php new file mode 100644 index 000000000..14fc59ce1 --- /dev/null +++ b/test/IsAssocArrayTest.php @@ -0,0 +1,56 @@ + 'bar', + )), + array(array( + 'bar', + 'foo' => 'bar', + 'baz', + )), + ); + } + + public static function invalidAssocArrays() + { + return array( + array(null), + array(true), + array(false), + array(0), + array(1), + array(0.0), + array(1.0), + array('string'), + array(array(0, 1, 2)), + array(new stdClass), + ); + } + + /** + * @dataProvider validAssocArrays + */ + public function testValidAssocArraysReturnTrue($test) + { + $this->assertTrue(IsAssocArray::test($test)); + } + + /** + * @dataProvider invalidAssocArrays + */ + public function testInvalidAssocArraysReturnFalse($test) + { + $this->assertFalse(IsAssocArray::test($test)); + } +}