IsAssociativeTest   A
last analyzed

Complexity

Total Complexity 3

Size/Duplication

Total Lines 41
Duplicated Lines 0 %

Coupling/Cohesion

Components 0
Dependencies 2

Importance

Changes 0
Metric Value
wmc 3
c 0
b 0
f 0
lcom 0
cbo 2
dl 0
loc 41
rs 10

3 Methods

Rating   Name   Duplication   Size   Complexity  
A testReturnsTrueForAssociateArray() 0 10 1
A testReturnsTrueForArrayWithNumericAndKeyIndexes() 0 10 1
A testReturnsFalseForNumericallyIndexedArray() 0 10 1
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