Created
September 16, 2013 10:27
-
-
Save markphi2013/6578961 to your computer and use it in GitHub Desktop.
programController test for program stats
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
public function mkStats() | |
{ | |
return array( | |
'ProgramStats' => array( | |
'active-participant-count' => '2', | |
'participant-count' => '2', | |
'all-received-messages-count'=> '2', | |
'current-month-received-messages-count' => '2', | |
'all-sent-messages-count' => '2', | |
'current-month-sent-messages-count' => '2', | |
'total-current-month-messages-count' => '2', | |
'history-count' => '1', | |
'today-schedule-count' => '2', | |
'schedule-count' => '2', | |
'object-type' => 'program-stats', | |
'model-version'=> '1' | |
)); | |
} | |
public function testProgramStats() | |
{ | |
$this->mockProgramAccess(); | |
$expected = $this->mkStats(); | |
$this->testAction("/programs/getProgramStats.json"); | |
//the problem is that iam trying to the testAction But it cann't even get to the getProgramStats() in the controller i need help with testAction pliz.thnx | |
//print_r($this->vars['program']); | |
// $this->assertEquals(); | |
} |
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
public function getProgramStats() | |
{ | |
if(isset($this->params['url']['program'])){ | |
$programUrl = $this->Program->find('first', array('conditions' => array('url'=> $this->params['url']['program']))); | |
$programStats = $this->Stats->getProgramStats($programUrl['Program']['database']); | |
$this->set(compact('programStats')); | |
} | |
} | |
//this is the function is the programcontroller AND below is the test that iam trying to do for it |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
public function mkStats()
{
return array('Program' => array(
'id' => 1,
'name' => 'test2',
'url' => 'test2',
'database' => 'testdbprogram',
'created' => '2012-01-24 15:29:24',
'modified' => '2012-01-24 15:29:24'
),
'ProgramStats' => array(
'active-participant-count' => '2',
'participant-count' => '2',
'all-received-messages-count'=> '2',
'current-month-received-messages-count' => '2',
'all-sent-messages-count' => '2',
'current-month-sent-messages-count' => '2',
'total-current-month-messages-count' => '2',
'history-count' => '1',
'today-schedule-count' => '2',
'schedule-count' => '2',
'object-type' => 'program-stats',
'model-version'=> '1'
));
}