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\DecompilePathTest |
20
|
|
|
* |
21
|
|
|
* covers Axstrad\Common\Util\ArrayUtil::decompilePath |
22
|
|
|
* @group unittest |
23
|
|
|
* @uses Axstrad\Common\Util\ArrayUtil |
24
|
|
|
*/ |
25
|
|
|
class DecompilePathTest extends \PHPUnit_Framework_TestCase |
26
|
|
|
{ |
27
|
|
|
/** |
28
|
|
|
*/ |
29
|
|
|
public function testCanParseDotNotation() |
30
|
|
|
{ |
31
|
|
|
$this->assertEquals(array('one', 'two', 'three'), ArrayUtil::decompilePath('one.two.three')); |
32
|
|
|
} |
33
|
|
|
|
34
|
|
|
/** |
35
|
|
|
*/ |
36
|
|
|
public function testCanParseArrayNotation() |
37
|
|
|
{ |
38
|
|
|
$this->assertEquals(array('one', 'two', 'three'), ArrayUtil::decompilePath('[one][two][three]')); |
39
|
|
|
} |
40
|
|
|
|
41
|
|
|
/** |
42
|
|
|
*/ |
43
|
|
|
public function testCanParseArrayNotation2() |
44
|
|
|
{ |
45
|
|
|
$this->assertEquals(array('one', 'two', 'three'), ArrayUtil::decompilePath('one[two][three]')); |
46
|
|
|
} |
47
|
|
|
|
48
|
|
|
/** |
49
|
|
|
* @uses Axstrad\Common\Util\Debug |
50
|
|
|
* @uses Axstrad\Common\Exception\InvalidArgumentException::create |
51
|
|
|
*/ |
52
|
|
|
public function testExpectException() |
53
|
|
|
{ |
54
|
|
|
$this->setExpectedException('Axstrad\Common\Exception\InvalidArgumentException'); |
55
|
|
|
|
56
|
|
|
ArrayUtil::decompilePath(new \StdClass); |
57
|
|
|
} |
58
|
|
|
} |
59
|
|
|
|