Completed
Push — b/update_guzzle ( 16f2fc...3512e8 )
by
unknown
07:47
created

ArrayUtilsTest::testToArrayWithInvalidValue()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 5
Code Lines 3

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
c 1
b 0
f 1
dl 0
loc 5
rs 9.4285
cc 1
eloc 3
nc 1
nop 0
1
<?php
2
/**
3
 * @author Antoine Hedgcock
4
 */
5
6
namespace CrateTest\Stdlib;
7
8
use ArrayIterator;
9
use Crate\Stdlib\ArrayUtils;
10
use PHPUnit_Framework_TestCase;
11
12
/**
13
 * Class ArrayUtilsTest
14
 *
15
 * @coversDefaultClass \Crate\Stdlib\ArrayUtils
16
 * @covers ::<!public>
17
 *
18
 * @group unit
19
 */
20
class ArrayUtilsTest extends PHPUnit_Framework_TestCase
21
{
22
    /**
23
     * @covers ::toArray
24
     */
25
    public function testToArrayWithNull()
26
    {
27
        $this->assertEquals([], ArrayUtils::toArray(null));
28
    }
29
30
    /**
31
     * @covers ::toArray
32
     */
33
    public function testToArrayWithArray()
34
    {
35
        $this->assertEquals(['hello' => 'world'], ArrayUtils::toArray(['hello' => 'world']));
36
    }
37
38
    /**
39
     * @covers ::toArray
40
     */
41
    public function testToArrayWithIterator()
42
    {
43
        $this->assertEquals(['hello' => 'world'], ArrayUtils::toArray(new ArrayIterator(['hello' => 'world'])));
44
    }
45
46
    /**
47
     * @covers ::toArray
48
     */
49
    public function testToArrayWithInvalidValue()
50
    {
51
        $this->setExpectedException('Crate\Stdlib\Exception\InvalidArgumentException');
52
        ArrayUtils::toArray('foo');
53
    }
54
}
55