【发布时间】:2019-02-18 13:22:55
【问题描述】:
如果我通过 url 运行代码,它就可以工作(例如:http://localhost:8080/projects/emailNewProject/2008098)
但如果我尝试通过http://localhost:8080/test.php?show=cases&app=true 访问它 它抛出错误:模型客户缺少数据库表
我尝试使用以下方法更改控制器中的数据源:
Configure::write('currentDataSource', 'testdb');
$dataSource = Configure::read('currentDataSource');
$this->setDataSource($dataSource);
还是不影响!!
class ProjectsControllerTest extends CakeTestCase{
function testEmailNewProject()
{
$id = 2008098;
$result = $this->testAction('/projects/emailNewProject', array('fixturize' => true, 'data' => $id, 'method' => 'post'));
debug($result);
}
}
【问题讨论】:
-
此链接中给出的示例enter link description here
-
@Chintan 我正在开发一个基于 Cakephp 1.3 的遗留项目,我没有尝试连接任何远程数据库。所有数据源都在本地主机中。
标签: cakephp cakephp-1.3