mirror of
https://github.com/silverstripe/doc.silverstripe.org
synced 2024-10-22 17:05:50 +02:00
7ecbf49ac9
git-svn-id: http://svn.silverstripe.com/projects/ss2doc/branches/v2@117896 467b73ca-7a2a-4603-9d3b-597d59a354a9
49 lines
758 B
PHP
49 lines
758 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',
|
|
),
|
|
)
|
|
);
|
|
}
|
|
|
|
function testValuekey() {
|
|
$this->assertEquals(
|
|
ArrayLib::valuekey(
|
|
array(
|
|
'testkey1' => 'testvalue1',
|
|
'testkey2' => 'testvalue2'
|
|
)
|
|
),
|
|
array(
|
|
'testvalue1' => 'testvalue1',
|
|
'testvalue2' => 'testvalue2'
|
|
)
|
|
);
|
|
}
|
|
|
|
} |