Skip to content

Commit 0f50d5e

Browse files
Add tests for dedicated status change modal actions
1 parent b0cae41 commit 0f50d5e

3 files changed

Lines changed: 104 additions & 0 deletions

File tree

modules/tests/CATSWebTestCase.php

Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -368,6 +368,45 @@ public function addPipelineActivity($candidateID, $jobOrderID,
368368
return true;
369369
}
370370

371+
public function changePipelineStatus($moduleName, $candidateID, $jobOrderID,
372+
$statusID, $addActivityProvided = false, $addActivity = true)
373+
{
374+
$postData = array(
375+
'postback' => 'postback',
376+
'candidateID' => $candidateID,
377+
'regardingID' => $jobOrderID,
378+
'statusID' => $statusID
379+
);
380+
381+
if ($addActivityProvided)
382+
{
383+
$postData['addActivityProvided'] = '1';
384+
$postData['addActivity'] = ($addActivity ? 'on' : 'off');
385+
}
386+
387+
/* Change candidate-job order pipeline status through the dedicated modal flow. */
388+
$this->assertPOST(
389+
$this->_indexURL . '?m=' . $moduleName . '&a=changeStatus',
390+
$postData,
391+
'Changing pipeline status should succeed'
392+
);
393+
if (!$this->runPageLoadAssertions(false))
394+
{
395+
return false;
396+
}
397+
398+
if ($moduleName == 'joborders')
399+
{
400+
$this->assertPattern('/The pipeline status has been changed from/');
401+
}
402+
else
403+
{
404+
$this->assertPattern('/The candidate\'s status has been changed from/');
405+
}
406+
407+
return true;
408+
}
409+
371410
public function addUser($firstName, $lastName, $username, $accessLevel,
372411
$password)
373412
{

modules/tests/testcases/AJAXTests.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -844,6 +844,7 @@ function testGetPipelineDetails()
844844

845845
/* There aren't any activity entries yet. */
846846
$this->assertPattern('/Added candidate to job order./');
847+
$this->assertNoPattern('/Status change:/');
847848

848849
/* Add an activity. */
849850
$this->addPipelineActivity(
@@ -853,6 +854,14 @@ function testGetPipelineDetails()
853854
'Test notes.'
854855
);
855856

857+
/* Change status through the dedicated Candidates modal action. */
858+
$this->changePipelineStatus(
859+
'candidates',
860+
$testCandidateID,
861+
$testJobOrderID1,
862+
PIPELINE_STATUS_SUBMITTED
863+
);
864+
856865
/* POST the AJAX call to ajax.php. */
857866
$this->post(
858867
CATSUtility::getAbsoluteURI('ajax.php'),
@@ -868,8 +877,32 @@ function testGetPipelineDetails()
868877
$this->assertPattern('/>Test notes.</');
869878
$this->assertPattern('/\(' . TESTER_FULLNAME . '\)/');
870879
$this->assertPattern('/>Activity History:</');
880+
$this->assertPattern('/Status change:.*Submitted/');
871881
$this->assertPattern('/' . date('m-d-y') . '/');
872882

883+
/* Change status through the dedicated Job Orders modal action, with activity opt-out. */
884+
$this->changePipelineStatus(
885+
'joborders',
886+
$testCandidateID,
887+
$testJobOrderID1,
888+
PIPELINE_STATUS_INTERVIEWING,
889+
true,
890+
false
891+
);
892+
893+
/* POST the AJAX call to ajax.php. */
894+
$this->post(
895+
CATSUtility::getAbsoluteURI('ajax.php'),
896+
array(
897+
'f' => 'getPipelineDetails',
898+
'candidateJobOrderID' => $candidateJobOrderID
899+
)
900+
);
901+
$this->runPageLoadAssertions(false);
902+
903+
$this->assertPattern('/Status change:.*Submitted/');
904+
$this->assertNoPattern('/Status change:.*Interviewing/');
905+
873906
/* Delete the test candidate. */
874907
$this->deleteCandidate($testCandidateID);
875908

0 commit comments

Comments
 (0)