| @@ 1200-1214 (lines=15) @@ | ||
| 1197 | $this->assertEquals('Phil', $list->first()->Name, 'First comment should be from Phil'); |
|
| 1198 | } |
|
| 1199 | ||
| 1200 | public function testSortByComplexExpression() { |
|
| 1201 | // Test an expression with both spaces and commas. This test also tests that column() can be called |
|
| 1202 | // with a complex sort expression, so keep using column() below |
|
| 1203 | $list = DataObjectTest_Team::get()->sort( |
|
| 1204 | 'CASE WHEN "DataObjectTest_Team"."ClassName" = \'DataObjectTest_SubTeam\' THEN 0 ELSE 1 END, "Title" DESC' |
|
| 1205 | ); |
|
| 1206 | $this->assertEquals(array( |
|
| 1207 | 'Subteam 3', |
|
| 1208 | 'Subteam 2', |
|
| 1209 | 'Subteam 1', |
|
| 1210 | 'Team 3', |
|
| 1211 | 'Team 2', |
|
| 1212 | 'Team 1', |
|
| 1213 | ), $list->column("Title")); |
|
| 1214 | } |
|
| 1215 | } |
|
| 1216 | ||
| @@ 160-171 (lines=12) @@ | ||
| 157 | ), $map->keys()); |
|
| 158 | } |
|
| 159 | ||
| 160 | public function testMethodAsValueField() { |
|
| 161 | $list = DataObjectTest_Team::get()->sort('Title'); |
|
| 162 | $map = new SS_Map($list, 'ID', 'MyTitle'); |
|
| 163 | $this->assertEquals(array( |
|
| 164 | 'Team Subteam 1', |
|
| 165 | 'Team Subteam 2', |
|
| 166 | 'Team Subteam 3', |
|
| 167 | 'Team Team 1', |
|
| 168 | 'Team Team 2', |
|
| 169 | 'Team Team 3' |
|
| 170 | ), $map->values()); |
|
| 171 | } |
|
| 172 | ||
| 173 | public function testUnshift() { |
|
| 174 | $list = DataObjectTest_TeamComment::get(); |
|