我编写了testAdd()
方法并尝试调试当前返回$this->Article->getInsertID();
的{{1}},null
正确显示新插入的数据。
debug($articles)
为什么public function testAdd() {
$data = array(
'Article' => array(
'title' => 'Fourth Title',
'content' => 'Fourth Title Body',
'published' => '1',
'created' => '2015-05-18 10:40:34',
'updated' => '2015-05019 10:23:34'
)
);
$this->_testAction('/articles/add', array('method' => 'post', 'data' => $data));
$articles = $this->Article->find('first', array('order' => array('id DESC')));
debug($articles);
debug($this->Article->getInsertID);
// return null.
}
会返回$this->Article->getInsertID()
?