开发者

Yii Best way to serve dummy RSS in Test

开发者 https://www.devze.com 2023-04-09 09:20 出处:网络
I have a PHP Yii application that uses an RSS feed reader. I wanted to develop some good tests, and I wanted to attempt to read an RSS feed under my own control as part of my test suite. The idea is I

I have a PHP Yii application that uses an RSS feed reader. I wanted to develop some good tests, and I wanted to attempt to read an RSS feed under my own control as part of my test suite. The idea is I request this feed 开发者_Python百科from "my.localhost/testfeed/{name}" and my application is served locally at "my.localhost"

I made a controller (TestFeedController) which uses the CViewAction to serve static rss files (stored in .php files). I had to put these in "protected/views/testFeed/pages/" to make it work.

I wanted to store the files in "protected/tests/views/testFeed/pages/" to separate them better from actual application code, but was unable to get this to work (I tried to overload getViewPath()). Is there a way to get a view file in CViewAction that is NOT in "protected/views/*"?

Is there a better way to test reading a "remote" RSS file which is under my local control? I considered serving it on another virtual host, but I wanted to keep the project tests with the project.


You could use RenderInternal for your test files and pass it an absolute filepath (e.g., dirname(FILE).'/../tests/views/..etc..'

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号