silverstripe-framework/tests/security/GroupTest.php
Ingo Schommer 60860cc1b9 MINOR Unified @package PHPdoc (added where missing, removed duplicates)
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@56212 467b73ca-7a2a-4603-9d3b-597d59a354a9
2008-06-15 13:33:53 +00:00

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);
}
}