CakePHP 是否有 app_fixture.php 或行为?
我想添加一个将由我的应用程序中的多个装置使用的函数,如果能够将它放在某个地方以反映它是 CakeTestFixture 的扩展,那就太好了。在模型中,我可以通过编写行为或将其添加到 app_model.php 来做到这一点。有没有办法为固定装置做到这一点?
我总是可以将它添加到我的静态实用程序类中,但如果能够更好地构造它就更好了。
I want to add a function that will be used by several fixtures in my app, and it would be nice to be able to put it somewhere reflecting that it's an extension to CakeTestFixture. In a Model, I could do this by writing a Behavior or adding it to app_model.php. Is there a way to do this for fixtures?
I can always just add it to my static Utility class, but it would be nice to be able to structure it better.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
编写一个
AppTestFixture
,它扩展CakeTestFixture
并将其包含在其中。显然,每个固定装置都必须扩展您的新类别,而不是 Cake 的新类别。Write an
AppTestFixture
which extendsCakeTestFixture
and include it in there. Obviously each fixture then has to extend your new class instead of Cake's one.