我正在检查CakePHP2中的单元测试。
OrdersController
$this->Discount->bindModel(array(
'hasOne' => array(
'Coupon' => array(
'foreignKey' => 'discount_id',
'join' => 'INNER',
),
),
));
$options = array();
$options['conditions'] = [
'Discount.status' => 1,
'Coupon.status' => 1,
];
$all_discounts = $this->Discount->find('all', $options);
OrdersControllerTest
public function testRestaurantDomain()
{
$this->testAction('/orders/index');
}
我收到SQLSTATE[42S22]: Column not found: 1054 Unknown column 'Coupon.status' in 'where clause'
错误。
当我评论Coupon.status
条件时,它工作正常。那么我在这里缺少什么让bindmodel与单元测试一起工作?