mirror of
https://github.com/php-curl-class/php-curl-class.git
synced 2026-08-31 04:34:27 +00:00
Add is_array_assoc() and array indexed and associative tests
This commit is contained in:
@@ -168,6 +168,10 @@ class Curl {
|
||||
public $response = NULL;
|
||||
}
|
||||
|
||||
function is_array_assoc($array) {
|
||||
return (bool)count(array_filter(array_keys($array), 'is_string'));
|
||||
}
|
||||
|
||||
function is_array_multidim($array) {
|
||||
if (!is_array($array)) {
|
||||
return FALSE;
|
||||
|
||||
@@ -10,6 +10,22 @@ class CurlTest extends PHPUnit_Framework_TestCase {
|
||||
$this->assertTrue(extension_loaded('curl'));
|
||||
}
|
||||
|
||||
public function testArrayAssociative() {
|
||||
$this->assertTrue(is_array_assoc(array(
|
||||
'foo' => 'wibble',
|
||||
'bar' => 'wubble',
|
||||
'baz' => 'wobble',
|
||||
)));
|
||||
}
|
||||
|
||||
public function testArrayIndexed() {
|
||||
$this->assertFalse(is_array_assoc(array(
|
||||
'wibble',
|
||||
'wubble',
|
||||
'wobble',
|
||||
)));
|
||||
}
|
||||
|
||||
public function testUserAgent() {
|
||||
$test = new Test();
|
||||
$test->curl->setUserAgent(Curl::USER_AGENT);
|
||||
|
||||
Reference in New Issue
Block a user