From 79b912f7b1686e29b502014bab228541300035c6 Mon Sep 17 00:00:00 2001 From: Ingo Schommer Date: Tue, 25 May 2010 04:23:44 +0000 Subject: [PATCH] BUG FIX: column names quoted properly (from r100693) git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@105625 467b73ca-7a2a-4603-9d3b-597d59a354a9 --- tests/security/GroupTest.php | 4 ++-- tests/security/PermissionCheckboxSetFieldTest.php | 12 ++++++------ tests/security/PermissionRoleTest.php | 4 ++-- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/tests/security/GroupTest.php b/tests/security/GroupTest.php index 8667dafff..7609e8d6b 100644 --- a/tests/security/GroupTest.php +++ b/tests/security/GroupTest.php @@ -83,8 +83,8 @@ class GroupTest extends FunctionalTest { $adminGroup->delete(); - $this->assertNull(DataObject::get('Group', "ID={$adminGroup->ID}"), 'Group is removed'); - $this->assertNull(DataObject::get('Permission',"GroupID={$adminGroup->ID}"), 'Permissions removed along with the group'); + $this->assertNull(DataObject::get('Group', "\"ID\"={$adminGroup->ID}"), 'Group is removed'); + $this->assertNull(DataObject::get('Permission',"\"GroupID\"={$adminGroup->ID}"), 'Permissions removed along with the group'); } } diff --git a/tests/security/PermissionCheckboxSetFieldTest.php b/tests/security/PermissionCheckboxSetFieldTest.php index 87e8e71c2..bb0638441 100644 --- a/tests/security/PermissionCheckboxSetFieldTest.php +++ b/tests/security/PermissionCheckboxSetFieldTest.php @@ -46,7 +46,7 @@ class PermissionCheckboxSetFieldTest extends SapphireTest { $this->assertEquals($group->Permissions()->Count(), 0, 'The tested group has no permissions'); $this->assertEquals($untouchable->Permissions()->Count(), 1, 'The other group has one permission'); - $this->assertEquals($untouchable->Permissions("Code='ADMIN'")->Count(), 1, 'The other group has ADMIN permission'); + $this->assertEquals($untouchable->Permissions("\"Code\"='ADMIN'")->Count(), 1, 'The other group has ADMIN permission'); $this->assertEquals(DataObject::get('Permission')->Count(), $baseCount, 'There are no orphaned permissions'); @@ -60,11 +60,11 @@ class PermissionCheckboxSetFieldTest extends SapphireTest { $group->flushCache(); $untouchable->flushCache(); $this->assertEquals($group->Permissions()->Count(), 2, 'The tested group has two permissions permission'); - $this->assertEquals($group->Permissions("Code='ADMIN'")->Count(), 1, 'The tested group has ADMIN permission'); - $this->assertEquals($group->Permissions("Code='CMS_ACCESS_AssetAdmin'")->Count(), 1, 'The tested group has CMS_ACCESS_AssetAdmin permission'); + $this->assertEquals($group->Permissions("\"Code\"='ADMIN'")->Count(), 1, 'The tested group has ADMIN permission'); + $this->assertEquals($group->Permissions("\"Code\"='CMS_ACCESS_AssetAdmin'")->Count(), 1, 'The tested group has CMS_ACCESS_AssetAdmin permission'); $this->assertEquals($untouchable->Permissions()->Count(), 1, 'The other group has one permission'); - $this->assertEquals($untouchable->Permissions("Code='ADMIN'")->Count(), 1, 'The other group has ADMIN permission'); + $this->assertEquals($untouchable->Permissions("\"Code\"='ADMIN'")->Count(), 1, 'The other group has ADMIN permission'); $this->assertEquals(DataObject::get('Permission')->Count(), $baseCount+2, 'There are no orphaned permissions'); @@ -77,10 +77,10 @@ class PermissionCheckboxSetFieldTest extends SapphireTest { $group->flushCache(); $untouchable->flushCache(); $this->assertEquals($group->Permissions()->Count(), 1, 'The tested group has 1 permission'); - $this->assertEquals($group->Permissions("Code='ADMIN'")->Count(), 1, 'The tested group has ADMIN permission'); + $this->assertEquals($group->Permissions("\"Code\"='ADMIN'")->Count(), 1, 'The tested group has ADMIN permission'); $this->assertEquals($untouchable->Permissions()->Count(), 1, 'The other group has one permission'); - $this->assertEquals($untouchable->Permissions("Code='ADMIN'")->Count(), 1, 'The other group has ADMIN permission'); + $this->assertEquals($untouchable->Permissions("\"Code\"='ADMIN'")->Count(), 1, 'The other group has ADMIN permission'); $this->assertEquals(DataObject::get('Permission')->Count(), $baseCount+1, 'There are no orphaned permissions'); } diff --git a/tests/security/PermissionRoleTest.php b/tests/security/PermissionRoleTest.php index a335133f4..3c389078e 100644 --- a/tests/security/PermissionRoleTest.php +++ b/tests/security/PermissionRoleTest.php @@ -11,7 +11,7 @@ class PermissionRoleTest extends FunctionalTest { $role->delete(); - $this->assertNull(DataObject::get('PermissionRole', "ID={$role->ID}"), 'Role is removed'); - $this->assertNull(DataObject::get('PermissionRoleCode',"RoleID={$role->ID}"), 'Permissions removed along with the role'); + $this->assertNull(DataObject::get('PermissionRole', "\"ID\"={$role->ID}"), 'Role is removed'); + $this->assertNull(DataObject::get('PermissionRoleCode',"\"RoleID\"={$role->ID}"), 'Permissions removed along with the role'); } }