mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-08-27 21:15:40 +02:00
33 lines
505 B
PHP
33 lines
505 B
PHP
|
<?php
|
||
|
/**
|
||
|
* @package sapphire
|
||
|
* @subpackage tests
|
||
|
*/
|
||
|
class ArrayLibTest extends SapphireTest {
|
||
|
function testInvert() {
|
||
|
$arr = array(
|
||
|
'row1' => array(
|
||
|
'col1' =>'val1',
|
||
|
'col2' => 'val2'
|
||
|
),
|
||
|
'row2' => array(
|
||
|
'col1' => 'val3',
|
||
|
'col2' => 'val4'
|
||
|
)
|
||
|
);
|
||
|
|
||
|
$this->assertEquals(
|
||
|
ArrayLib::invert($arr),
|
||
|
array(
|
||
|
'col1' => array(
|
||
|
'row1' => 'val1',
|
||
|
'row2' => 'val3',
|
||
|
),
|
||
|
'col2' => array(
|
||
|
'row1' => 'val2',
|
||
|
'row2' => 'val4',
|
||
|
),
|
||
|
)
|
||
|
);
|
||
|
}
|
||
|
}
|