mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
FIX use @param $colName in column call
This commit is contained in:
parent
ee717c7f66
commit
cf456d6625
@ -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);
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user