Skip to content

Instantly share code, notes, and snippets.

@tareko
Created June 11, 2012 04:48
Show Gist options
  • Select an option

  • Save tareko/2908555 to your computer and use it in GitHub Desktop.

Select an option

Save tareko/2908555 to your computer and use it in GitHub Desktop.
Test to see if bad save responds properly
public function testAddPostFailedSave() {
//TODO: Fix broken test
$Trades = $this->generate('Trades', array(
'methods' => array(
'_requestAllowed',
'saveAssociated'
),
));
$Trades->expects($this->any())
->method('_requestAllowed')
->will($this->returnValue(true));
$Trades->expects($this->any())
->method('saveAssociated')
->will($this->returnValue(false));
$data = array(
'Trade' => array(
'user_id' => 1,
'shift_id' => 16,
'status' => 0,
),
'TradesDetail' => array(
0 => array(
'user_id' => 2
),
1 => array(
'user_id' => 3)
)
);
$result = $this->testAction('/trades/add', array('data' => $data, 'method' => 'post'));
// $this->assertTrue($this->Comments->viewVars['success']);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment