/** * testSaveHabtmCustomKeys method * * @return void */ public function testSaveHabtmCustomKeys() { $this->loadFixtures('Story', 'StoriesTag', 'Tag'); $Story = new Story(); $data = array('Story' => array('story' => '1'), 'Tag' => array('Tag' => array(2, 3))); $result = $Story->set($data); $this->assertFalse(empty($result)); $result = $Story->save(); $this->assertFalse(empty($result)); $result = $Story->find('all', array('order' => array('Story.story'))); $expected = array(array('Story' => array('story' => 1, 'title' => 'First Story'), 'Tag' => array(array('id' => 2, 'tag' => 'tag2', 'created' => '2007-03-18 12:24:23', 'updated' => '2007-03-18 12:26:31'), array('id' => 3, 'tag' => 'tag3', 'created' => '2007-03-18 12:26:23', 'updated' => '2007-03-18 12:28:31'))), array('Story' => array('story' => 2, 'title' => 'Second Story'), 'Tag' => array())); $this->assertEquals($expected, $result); }