Last active
December 31, 2015 14:18
-
-
Save awrowse/7998905 to your computer and use it in GitHub Desktop.
Test of commit() issue in RightNow CX 13.2 SP5 via CP controller
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
namespace Custom\Controllers; | |
assert_options(ASSERT_ACTIVE, 1); | |
assert_options(ASSERT_WARNING, 0); | |
assert_options(ASSERT_QUIET_EVAL, 1); | |
//assertion handler | |
\assert_options(ASSERT_CALLBACK, function ($file, $line, $code) | |
{ | |
echo "<p>Assertion Failed:<br/> | |
Line '$line'<br /> | |
Code '$code'</p><hr />"; | |
}); | |
class SP5Regression extends \RightNow\Controllers\Base | |
{ | |
function __construct() | |
{ | |
parent::__construct(); | |
} | |
public function test(){ | |
$contact = \RightNow\Connect\v1_2\Contact::fetch(64582); | |
$lead = \RightNow\Connect\v1_2\Leads\Lead::fetch(9); | |
$incident = \RightNow\Connect\v1_2\Incident::fetch(428911); | |
$opp = \RightNow\Connect\v1_2\Opportunity::fetch(264130); | |
echo "<h1>Control Group. Should see no errors</h1>"; | |
assert('$contact->Login == "pta_524ca9322905f3.10140019"'); | |
assert('$contact->Name->Last == "Rowse"'); | |
assert('$contact->Emails[0]->Address == "[email protected]"'); | |
assert('$contact->CustomFields->c->outreach_opt_in->LookupName == "Yes - Active"'); | |
assert('$contact->Address->Street == "100 Main Street"'); | |
assert('$lead->LastName == "Rowse"'); | |
assert('$lead->State->LookupName == "CA"'); | |
assert('$lead->Request->ID == 23'); | |
assert('$incident->Subject == "Test of SP5"'); | |
assert('$incident->CustomFields->c->callback_number == "4066249655"'); | |
assert('$incident->ReferenceNumber == "131212-000001"'); | |
assert('$incident->Category->Name == "Application Assistance"'); | |
assert('$opp->Name == "Test of SP5"'); | |
assert('$opp->CustomFields->c->score->LookupName == "Medium"'); | |
assert('$opp->CustomFields->c->progress->LookupName == "Expressed Interest"'); | |
assert('$opp->CustomFields->Leads->ConvAttempts == 3'); | |
//Make sure an update occurs | |
$opp->CustomFields->c->calheers_app_id = ($opp->CustomFields->c->calheers_app_id + 1); | |
$incident->CustomFields->c->call_back = !$incident->CustomFields->c->call_back; | |
$contact->Name->First = ($contact->Name->First == "Andy" ) ? "Andrew" : "Andy"; | |
$lead->FirstName = ($contact->FirstName == "Andy" ) ? "Andrew" : "Andy"; | |
\RightNow\Libraries\AbuseDetection::isAbuse(); | |
$contact->save(\RightNow\Connect\v1_2\RNObject::SuppressAll); | |
$incident->save(\RightNow\Connect\v1_2\RNObject::SuppressAll); | |
$lead->save(\RightNow\Connect\v1_2\RNObject::SuppressAll); | |
$opp->save(\RightNow\Connect\v1_2\RNObject::SuppressAll); | |
\RightNow\Connect\v1_2\ConnectAPI::commit(); | |
echo "<h1>Results. Hope to see no errors</h1>"; | |
assert('$contact->Login == "pta_524ca9322905f3.10140019"'); //fails | |
assert('$contact->Name->Last == "Rowse"'); //fails | |
assert('$contact->Emails[0]->Address == "[email protected]"'); //succeeds | |
assert('$contact->CustomFields->c->outreach_opt_in->LookupName == "Yes - Active"'); //succeeds | |
assert('$contact->Address->Street == "100 Main Street"'); //fails | |
assert('$lead->LastName == "Rowse"'); //succeeds | |
assert('$lead->State->LookupName == "CA"'); //succeeds | |
assert('$lead->Request->ID == 23'); //succeeds | |
assert('$incident->Subject == "Test of SP5"'); //succeeds | |
assert('$incident->CustomFields->c->callback_number == "4066249655"'); //fails | |
assert('$incident->ReferenceNumber == "131212-000001"'); //succeeds | |
assert('$incident->Category->Name == "Application Assistance"'); //fails | |
assert('$opp->Name == "Test of SP5"'); //succeeds | |
assert('$opp->CustomFields->c->score->LookupName == "Medium"'); //fails | |
assert('$opp->CustomFields->c->progress->LookupName == "Expressed Interest"'); //fails | |
assert('$opp->CustomFields->Leads->ConvAttempts == 3'); //fails | |
} | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment