mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
MINOR: Replaced usage of deprecated toDropdownMap() with map().
This commit is contained in:
parent
14c57ae082
commit
c025ce7a4a
@ -51,7 +51,7 @@ class TableFieldTest extends SapphireTest {
|
|||||||
$tableField->saveInto($group);
|
$tableField->saveInto($group);
|
||||||
|
|
||||||
// Let's check that the 2 permissions entries have been saved
|
// Let's check that the 2 permissions entries have been saved
|
||||||
$permissions = $group->Permissions()->toDropdownMap('Arg', 'Code');
|
$permissions = $group->Permissions()->map('Arg', 'Code');
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
1 => 'CustomPerm1',
|
1 => 'CustomPerm1',
|
||||||
2 => 'CustomPerm2',
|
2 => 'CustomPerm2',
|
||||||
@ -75,7 +75,7 @@ class TableFieldTest extends SapphireTest {
|
|||||||
$tableField->saveInto($group);
|
$tableField->saveInto($group);
|
||||||
|
|
||||||
// Let's check that the 2 existing permissions entries, and the 1 new one, have been saved
|
// Let's check that the 2 existing permissions entries, and the 1 new one, have been saved
|
||||||
$permissions = $group->Permissions()->toDropdownMap('Arg', 'Code');
|
$permissions = $group->Permissions()->map('Arg', 'Code');
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
1 => 'CustomPerm1',
|
1 => 'CustomPerm1',
|
||||||
2 => 'CustomPerm2',
|
2 => 'CustomPerm2',
|
||||||
@ -126,7 +126,7 @@ class TableFieldTest extends SapphireTest {
|
|||||||
$tableField->saveInto($group);
|
$tableField->saveInto($group);
|
||||||
|
|
||||||
// Let's check that the 2 permissions entries have been saved
|
// Let's check that the 2 permissions entries have been saved
|
||||||
$permissions = $group->Permissions()->toDropdownMap('Arg', 'Code');
|
$permissions = $group->Permissions()->map('Arg', 'Code');
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
101 => 'Perm1 Modified',
|
101 => 'Perm1 Modified',
|
||||||
102 => 'Perm2 Modified',
|
102 => 'Perm2 Modified',
|
||||||
|
@ -52,7 +52,7 @@ class TableListFieldTest extends SapphireTest {
|
|||||||
$items = $table->sourceItems();
|
$items = $table->sourceItems();
|
||||||
$this->assertNotNull($items);
|
$this->assertNotNull($items);
|
||||||
|
|
||||||
$itemMap = $items->toDropdownMap("ID", "A") ;
|
$itemMap = $items->map("ID", "A") ;
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
$item1->ID => "a1",
|
$item1->ID => "a1",
|
||||||
$item2->ID => "a2",
|
$item2->ID => "a2",
|
||||||
@ -88,7 +88,7 @@ class TableListFieldTest extends SapphireTest {
|
|||||||
$items = $table->sourceItems();
|
$items = $table->sourceItems();
|
||||||
$this->assertNotNull($items);
|
$this->assertNotNull($items);
|
||||||
|
|
||||||
$itemMap = $items->toDropdownMap("ID", "A") ;
|
$itemMap = $items->map("ID", "A") ;
|
||||||
$this->assertEquals(array(
|
$this->assertEquals(array(
|
||||||
$item1->ID => "a1",
|
$item1->ID => "a1",
|
||||||
$item2->ID => "a2"
|
$item2->ID => "a2"
|
||||||
@ -122,7 +122,7 @@ class TableListFieldTest extends SapphireTest {
|
|||||||
$items = $table->sourceItems();
|
$items = $table->sourceItems();
|
||||||
$this->assertNotNull($items);
|
$this->assertNotNull($items);
|
||||||
|
|
||||||
$itemMap = $items->toDropdownMap("ID", "A") ;
|
$itemMap = $items->map("ID", "A") ;
|
||||||
$this->assertEquals(array($item3->ID => "a3", $item4->ID => "a4"), $itemMap);
|
$this->assertEquals(array($item3->ID => "a3", $item4->ID => "a4"), $itemMap);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -177,25 +177,16 @@ class DataObjectSetTest extends SapphireTest {
|
|||||||
$comments = DataObject::get('DataObjectSetTest_TeamComment', '', "\"ID\" ASC");
|
$comments = DataObject::get('DataObjectSetTest_TeamComment', '', "\"ID\" ASC");
|
||||||
|
|
||||||
/* Now we get a map of all the PageComment records */
|
/* Now we get a map of all the PageComment records */
|
||||||
$map = $comments->map('ID', 'Title', '(Select one)');
|
$map = $comments->map('ID', 'Title');
|
||||||
|
|
||||||
$expectedMap = array(
|
$expectedMap = array(
|
||||||
'' => '(Select one)',
|
|
||||||
1 => 'Joe',
|
1 => 'Joe',
|
||||||
2 => 'Bob',
|
2 => 'Bob',
|
||||||
3 => 'Phil'
|
3 => 'Phil'
|
||||||
);
|
);
|
||||||
|
|
||||||
/* There are 9 items in the map. 3 are records. 1 is the empty value */
|
/* There are 9 items in the map. 3 are records. 1 is the empty value */
|
||||||
$this->assertEquals(count($map), 4, 'There are 4 items in the map. 3 are records. 1 is the empty value');
|
$this->assertEquals(count($map), 3, 'There are 3 items in the map.');
|
||||||
|
|
||||||
/* We have the same map as our expected map, asserted above */
|
|
||||||
|
|
||||||
/* toDropDownMap() is an alias of map() - let's make a map from that */
|
|
||||||
$map2 = $comments->toDropDownMap('ID', 'Title', '(Select one)');
|
|
||||||
|
|
||||||
/* There are 4 items in the map. 3 are records. 1 is the empty value */
|
|
||||||
$this->assertEquals(count($map), 4, 'There are 4 items in the map. 3 are records. 1 is the empty value.');
|
|
||||||
}
|
}
|
||||||
|
|
||||||
function testRemoveDuplicates() {
|
function testRemoveDuplicates() {
|
||||||
|
@ -128,7 +128,7 @@ class GroupTest_Member extends Member implements TestOnly {
|
|||||||
|
|
||||||
function getCMSFields() {
|
function getCMSFields() {
|
||||||
$groups = DataObject::get('Group');
|
$groups = DataObject::get('Group');
|
||||||
$groupsMap = ($groups) ? $groups->toDropDownMap() : false;
|
$groupsMap = ($groups) ? $groups->map() : false;
|
||||||
$fields = new FieldSet(
|
$fields = new FieldSet(
|
||||||
new HiddenField('ID', 'ID'),
|
new HiddenField('ID', 'ID'),
|
||||||
new CheckboxSetField(
|
new CheckboxSetField(
|
||||||
|
Loading…
Reference in New Issue
Block a user