CakePHP PHPUnit测试

时间:2015-08-24 09:00:12

标签: cakephp phpunit

我编写了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()

0 个答案:

没有答案