mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
88d79d1b62
http://svn.silverstripe.com/open/modules/sapphire/branches/2.2.2 ........ r52224 | sminnee | 2008-04-07 11:45:23 +1200 (Mon, 07 Apr 2008) | 1 line #2314 - Fixed SQLMap implementation so that Group::map() returns appropriate data, and the group dropdown on the access tab works. ........ git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@53508 467b73ca-7a2a-4603-9d3b-597d59a354a9
25 lines
814 B
PHP
25 lines
814 B
PHP
<?php
|
|
|
|
class GroupTest extends SapphireTest {
|
|
static $fixture_file = 'sapphire/tests/security/GroupTest.yml';
|
|
|
|
/**
|
|
* Test the Group::map() function
|
|
*/
|
|
function testGroupMap() {
|
|
/* Group::map() returns an SQLMap object implementing iterator. You can use foreach to get ID-Title pairs. */
|
|
|
|
// We will iterate over the map and build mapOuput to more easily call assertions on the result.
|
|
$map = Group::map();
|
|
foreach($map as $k => $v) {
|
|
$mapOutput[$k] = $v;
|
|
}
|
|
|
|
$group1 = $this->objFromFixture('Group', 'group1');
|
|
$group2 = $this->objFromFixture('Group', 'group2');
|
|
|
|
/* We have added 2 groups to our fixture. They should both appear in $mapOutput. */
|
|
$this->assertEquals($mapOutput[$group1->ID], $group1->Title);
|
|
$this->assertEquals($mapOutput[$group2->ID], $group2->Title);
|
|
}
|
|
} |