mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
60860cc1b9
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56212 467b73ca-7a2a-4603-9d3b-597d59a354a9
28 lines
863 B
PHP
28 lines
863 B
PHP
<?php
|
|
/**
|
|
* @package sapphire
|
|
* @subpackage tests
|
|
*/
|
|
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);
|
|
}
|
|
} |