FIX use @param $colName in column call

This commit is contained in:
Gabrijel Gavranović 2014-08-26 13:27:18 +02:00 committed by Damian Mooyman
parent ee717c7f66
commit cf456d6625
2 changed files with 24 additions and 1 deletions

View File

@ -261,7 +261,7 @@ class UnsavedRelationList extends ArrayList {
*/
public function column($colName = 'ID') {
$list = new ArrayList($this->toArray());
return $list->column('ID');
return $list->column($colName);
}
/**

View File

@ -183,6 +183,29 @@ class UnsavedRelationListTest extends SapphireTest {
$child3->ID => $child3->ID
));
}
public function testColumn() {
$object = new UnsavedRelationListTest_DataObject;
$children = $object->Children();
$children->add(new UnsavedRelationListTest_DataObject(array('Name' => 'A')));
$children->add(new UnsavedRelationListTest_DataObject(array('Name' => 'B')));
$children->add(new UnsavedRelationListTest_DataObject(array('Name' => 'C')));
$children = $object->Children();
$this->assertDOSEquals(array(
array('Name' => 'A'),
array('Name' => 'B'),
array('Name' => 'C')
), $children);
$this->assertEquals($children->column('Name'), array(
'A',
'B',
'C'
));
}
}
class UnsavedRelationListTest_DataObject extends DataObject implements TestOnly {