testReturnsTrueForAssociateArray()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 10
Code Lines 6

Duplication

Lines 0
Ratio 0 %

Importance

Changes 0
Metric Value
c 0
b 0
f 0
dl 0
loc 10
rs 9.4285
cc 1
eloc 6
nc 1
nop 0
1
<?php
2
/**
3
 * This file is part of the Axstrad library.
4
 *
5
 * (c) Dan Kempster <[email protected]>
6
 *
7
 * For the full copyright and license information, please view the LICENSE
8
 * file that was distributed with this source code.
9
 *
10
 * @author Dan Kempster <[email protected]>
11
 * @package Axstrad\Common
12
 * @subpackage Tests
13
 */
14
namespace Axstrad\Common\Tests\Util\ArrayUtil;
15
16
use Axstrad\Common\Util\ArrayUtil;
17
18
/**
19
 * Axstrad\Common\Tests\Util\ArrayUtil\IsAssociativeTest
20
 *
21
 * covers Axstrad\Common\Util\ArrayUtil::isAssociative
22
 * @group unittest
23
 */
24
class IsAssociativeTest extends \PHPUnit_Framework_TestCase
25
{
26
    /**
27
     */
28
    public function testReturnsTrueForAssociateArray()
29
    {
30
        $this->assertTrue(
31
            ArrayUtil::isAssociative(array(
32
                'one' => 'one',
33
                'two' => 'two',
34
                'three' => 'three',
35
            ))
36
        );
37
    }
38
39
    /**
40
     */
41
    public function testReturnsTrueForArrayWithNumericAndKeyIndexes()
42
    {
43
        $this->assertTrue(
44
            ArrayUtil::isAssociative(array(
45
                'one' => 'one',
46
                'two' => 'two',
47
                3 => 'three',
48
            ))
49
        );
50
    }
51
52
    /**
53
     */
54
	public function testReturnsFalseForNumericallyIndexedArray()
55
	{
56
		$this->assertFalse(
57
			ArrayUtil::isAssociative(array(
58
				1 => 'one',
59
				2 => 'two',
60
				3 => 'three',
61
			))
62
		);
63
	}
64
}
65