我一直在尝试,但徒劳无功,在cakePhP中创建了多个灯具。目前,我需要测试一个需要两个不同灯具数据库表的函数。如果可能的话,有人可以发布一些简单的代码片段,并让我创建多个设备。在cakePhp中创建多个灯具pixelp
2
A
回答
4
炉,
你采取一看蛋糕的bake
效用?你可以用它来烘烤灯具。
cake bake fixture all
在您的应用程序中一次烘烤所有灯具。小心使用以免覆盖现有代码。
Edit0: 使用
cake bake fixture help
如果您还有其他问题
。
4
这里有一个简单的夹具:应用程序/测试/夹具/ entity_fixtures.php 在你的情况,你将创建两个这些文件中,每一个模型,并用不同的名称。
<?php
class EntityFixture extends CakeTestFixture {
var $name = 'Entity';
var $table = 'entities';
// Define the fields
var $fields = array(
'entity_id' => array('type' => 'integer', 'key' => 'primary'),
'type' => array('type' => 'string' , 'length' => 255),
'created' => 'datetime',
'modified' => 'datetime'
);
var $records = array(
array('entity_id' => 1, 'type' => 'entity', 'created'=>'2010-01-01', 'modified' => '2010-01-01')
);
}
?>
当你的测试用例包括您在灯具测试案例的顶部
class EntityTestCase extends CakeTestCase {
var $fixtures = array(
'plugin.myplugin.entity', // Including a sample plugin fixture
'entity', // The fixture above shown in code above
'blogs' // Including a third fixture (should be in app/tests/fixtures/blog_fixture.php)
);
}
相关问题
- 1. 在cmocka中创建灯具
- 2. 学说:为某个表创建灯具
- 3. 用python创建多个ppt幻灯片
- 4. django灯具:在syncdb上加载多个灯具
- 5. 在opengl中创建路灯
- 6. 如何在cakephp中创建多个ajax请求
- 7. 在CakePHP中创建多个tinyint(1)字段的下拉菜单
- 8. 在CakePHP 2.0中创建CountDown
- 9. 不能创建在CakePHP中
- 10. 创建可重用的py.text灯具
- 11. 创建一个幻灯片
- 12. 如何在CakePHP的单个页面上创建多个表单?
- 13. 在其他fitnesse灯具中使用let创建变量
- 14. 使用模板创建具有R的幻灯片幻灯片
- 15. 创建具有多个变量的宏
- 16. 如何创建多个工具提示?
- 17. 如何创建具有多个列
- 18. 一次加载多个灯具
- 19. 可以使用多个fitnesse灯具
- 20. 在PHP中创建“聚光灯搜索”
- 21. 在jQuery中创建幻灯片效果
- 22. 在CareKit中创建具有多个参数的图表
- 23. SQLite在Android中创建具有多个主键的表格
- 24. 在Oracle EBS中创建具有多个地址的客户(12.1)
- 25. 如何在OCaml中创建具有多个参数的类型?
- 26. 在铅笔项目中创建多个标签WIreframing工具
- 27. 在R#7.0中并行运行多个灯具
- 28. 具有多个状态的Cakephp模型
- 29. 如何在cakephp 3.2中创建多语言静态网站?
- 30. 如何在CakePHP中与许多hasMany关联创建mysql表?