Permalink
Browse files

MINOR Added tests for SS_Map testing value method instead of value field

  • Loading branch information...
1 parent f5a91cb commit 9b0009643a10df0b07da1e74b9db97530ad6559e @halkyon halkyon committed Mar 15, 2012
Showing with 20 additions and 2 deletions.
  1. +5 −1 tests/model/DataObjectTest.php
  2. +15 −1 tests/model/MapTest.php
@@ -1051,7 +1051,11 @@ class DataObjectTest_Team extends DataObject implements TestOnly {
'Position' => 'Varchar(100)'
)
);
-
+
+ function MyTitle() {
+ return 'Team ' . $this->Title;
+ }
+
function getDynamicField() {
return 'dynamicfield';
}
View
@@ -68,6 +68,20 @@ function testKeys() {
), $map->keys());
}
+ function testMethodAsValueField() {
+ $list = DataList::create('DataObjectTest_Team');
+ $list->sort('Title');
+ $map = new SS_Map($list, 'ID', 'MyTitle');
+ $this->assertEquals(array(
+ 'Team Subteam 1',
+ 'Team Subteam 2',
+ 'Team Subteam 3',
+ 'Team Team 1',
+ 'Team Team 2',
+ 'Team Team 3'
+ ), $map->values());
+ }
+
function testValues() {
$list = DataList::create('DataObjectTest_TeamComment');
$list->sort('Name');
@@ -129,4 +143,4 @@ function testUnshift() {
}
-}
+}

0 comments on commit 9b00096

Please sign in to comment.