Permalink
Browse files

adding language to be included in transfer

  • Loading branch information...
1 parent 604ac09 commit 3902abc2d1b9fa615d915547370378e0c2f72a4a @mickle00 committed Apr 4, 2012
Showing with 23 additions and 2 deletions.
  1. +1 −0 .gitattributes
  2. +2 −1 src/classes/CaseTransferController.cls
  3. +20 −1 src/classes/CaseTransferController_Test.cls
View
@@ -0,0 +1 @@
+* -whitespace
@@ -67,7 +67,7 @@ public class CaseTransferController{
private List<Case_Team__c> getAllCaseTeams(){
if (this.allCaseTeams == null){
this.allCaseTeams = new List<Case_Team__c>();
- this.allCaseTeams = [SELECT Id, Name, Record_Type_Developer_Name__c, Email__c, Team__c FROM Case_Team__c WHERE Active__c = true order by Name ASC];
+ this.allCaseTeams = [SELECT Id, Name, Record_Type_Developer_Name__c, Email__c, Team__c, Language__c FROM Case_Team__c WHERE Active__c = true order by Name ASC];
}
return this.allCaseTeams;
}
@@ -89,6 +89,7 @@ public class CaseTransferController{
,AccountId = parentCase.AccountId
//,Prevent_Contact_Lookup__c = true
,Status = 'New - Transferred'
+ ,Language__c = this.getCaseTeamMap().get(transferringToCaseTeam).Language__c
,Team__c = this.getCaseTeamMap().get(transferringToCaseTeam).Team__c
,RecordTypeId = this.getCaseTeamToRecordTypeIdMap().get(transferringToCaseTeam));
@@ -17,7 +17,12 @@ private class CaseTransferController_Test {
static Case_Team__c getNewCaseTeam(){
RecordType randomRecordType = [SELECT Id, DeveloperName FROM RecordType WHERE sObjectType = 'Case'AND isActive = true LIMIT 1];
- testCaseTeam = new Case_Team__c (Name = 'TestCaseTeam', Record_Type_Developer_Name__c = randomRecordType.DeveloperName, Email_Service_Address__c = 'fake@nevergoingtohappen.org');
+ Language__c testLanguage = new Language__c(Name = 'TestLanguage');
+ insert testLanguage;
+ testCaseTeam = new Case_Team__c (Name = 'TestCaseTeam'
+ ,Record_Type_Developer_Name__c = randomRecordType.DeveloperName
+ ,Email_Service_Address__c = 'fake@nevergoingtohappen.org'
+ ,Language__c = testLanguage.Id);
insert testCaseTeam;
return testCaseTeam;
}
@@ -56,4 +61,18 @@ private class CaseTransferController_Test {
List<CaseComment> childCaseComments = [SELECT Id FROM CaseComment WHERE ParentID = :newChildCases[0].Id];
system.assertEquals(1, childCaseComments.size());
}
+ static testMethod void shouldHaveLanguageAssociated() {
+ CaseTransferController myController = getTestController();
+ Case_Team__c newCaseTeam = getNewCaseTeam();
+ List<Case> previousChildCases = [SELECT Id, RecordType.DeveloperName FROM Case WHERE ParentId = :testCase.Id];
+ myController.transferringToCaseTeam = newCaseTeam.Name;
+ String nextPage = myController.transferCase().getUrl();
+
+ List<Case> newChildCases = [SELECT Id, RecordType.DeveloperName, Language__c FROM Case WHERE ParentID = :testCase.Id];
+ system.assertEquals(previousChildCases.size() + 1, newChildCases.size());
+ system.assertEquals(newChildCases[0].Language__c, newCaseTeam.Language__c);
+
+ List<CaseComment> childCaseComments = [SELECT Id FROM CaseComment WHERE ParentID = :newChildCases[0].Id];
+ system.assertEquals(1, childCaseComments.size());
+ }
}

0 comments on commit 3902abc

Please sign in to comment.