CakePHP Test Suite
I have some problems with the TestSuite. Controller functions: function admin_view($id = null) { if (!$id) { $this-Session-setFlash(__('Invalid Article.', true)); $this-redirect(array('action'='index')); } $this-set('article', $this-Article-read(null, $id)); } function admin_add() { if (!empty($this-data)) { $this-Article-create(); $this-data['Article']['text'] = $this-__formatText($this-data ['Article']['text']); if ($this-Article-save($this-data)) { $this-Session-setFlash(__('The Article has been saved', true)); // $this-redirect(array('action'='index')); } else { $result = true; $this-Session-setFlash(__('The Article could not be saved. Please, try again.', true)); } $result = $this-Article-findAll(); } $authors = $this-Article-Author-find('list'); $this-set(compact('authors')); } Test file: ?php /* SVN FILE: $Id$ */ /* ArticlesController Test cases generated on: 2008-12-22 18:12:14 : 1229966834*/ App::import('Controller', 'Articles'); class TestArticles extends ArticlesController { var $autoRender = false; } class ArticlesControllerTest extends CakeTestCase { var $Articles = null; function setUp() { $this-Articles = new TestArticles(); $this-Articles-constructClasses(); } function testArticlesControllerInstance() { $this-assertTrue(is_a($this-Articles, 'ArticlesController')); } function testAddMargin() { $expected = 160; $result = $this-Articles-__addMargin(100, 0.6); debug('Expected: '. $expected); debug('Result: '. $result); $this-assertEqual($result, $expected); } function testAdminArticleDetail() { $viewVars = $this-testAction('/admin/articles/view/1', array ('return' = 'vars')); debug(is_array($viewVars['article']['Article'])); $this-assertTrue(is_array($viewVars['article']['Article'])); } function testAdminArticlesAdd() { $result = $this-testAction( '/admin/articles/add', array( 'method' = 'post', 'data' = array('Article' = array( 'headline_1' = 'Lorem ipsum dolor sit amet', 'text' = 'Lorem ipsum dolor sit amet, aliquet feugiat.' )), 'fixturize' = false, 'return' = 'render' )); debug($result); $this-assertTrue(preg_match('/has been saved/i', $result)); } function tearDown() { unset($this-Articles); } } ? Now my Problem: 1. When I write another value than 'return' = 'vars', I don't get an output. So testAdminArticlesAdd() fails! 2. testAdminArticleDetail() don't fail, but when I click on 'Show Passes', I get this error: Missung Contoller - Error: Test.phpController could not be found. 3. When I set 'fixturize' true, the testAdminArticlesAdd() test fails because a table is missing. Not the article table, but a table which has a relation to article. 4. // $this-redirect(array('action'='index')); Problem: I have try out some solutions, but no one really works. Is there an example for a working solution. --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups CakePHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
cakephp test suite 1.1
Hello, Can any body provide me cakephp 1.1 with integrated test suite 1.1. Your help will highly appreciated. Thank you. Regards, Jahangir --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cakephp test suite 1.1
Look in http://cakeforge.org === Http://blog.samdevore.com On Feb 17, 2008, at 8:28 AM, Jay [EMAIL PROTECTED] wrote: Hello, Can any body provide me cakephp 1.1 with integrated test suite 1.1. Your help will highly appreciated. Thank you. Regards, Jahangir --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cakephp test suite 1.1
there is no integrated test suite for cakephp 1.1 there in only the test suite that you can use with it (you also need the php SimpleTest (search google for it if it is not linked in the source for cake test suite) integrated testing was not added to cake until 1.2 Sam D On Feb 17, 2008 1:21 PM, Jay [EMAIL PROTECTED] wrote: Dear Sam, I need integrated test suite 1.0 with cake 1.1. not just test suite. On Feb 17, 8:55 pm, Sam DeVore [EMAIL PROTECTED] wrote: Look inhttp://cakeforge.org === Http://blog.samdevore.com On Feb 17, 2008, at 8:28 AM, Jay [EMAIL PROTECTED] wrote: Hello, Can any body provide me cakephp 1.1 with integrated test suite 1.1. Your help will highly appreciated. Thank you. Regards, Jahangir -- -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/ http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/ http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cakephp test suite 1.1
Dear Sam, I need integrated test suite 1.0 with cake 1.1. not just test suite. On Feb 17, 8:55 pm, Sam DeVore [EMAIL PROTECTED] wrote: Look inhttp://cakeforge.org === Http://blog.samdevore.com On Feb 17, 2008, at 8:28 AM, Jay [EMAIL PROTECTED] wrote: Hello, Can any body provide me cakephp 1.1 with integrated test suite 1.1. Your help will highly appreciated. Thank you. Regards, Jahangir --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: cakephp test suite 1.1
I know that there is no integrated test suite for cake 1.1, but I am requesting that if any body has integrate it locally for his/her self for testing purpose, then s/he can help me in this regards. As I previously send a link to you, in which a user has integrate it with cake, i.e. http://timgourley.com/directory/tests/ Hope you understand it and help me. Thanks Regards, Jahangir On Feb 18, 1:24 am, Samuel DeVore [EMAIL PROTECTED] wrote: there is no integrated test suite for cakephp 1.1 there in only the test suite that you can use with it (you also need the php SimpleTest (search google for it if it is not linked in the source for cake test suite) integrated testing was not added to cake until 1.2 Sam D On Feb 17, 2008 1:21 PM, Jay [EMAIL PROTECTED] wrote: Dear Sam, I need integrated test suite 1.0 with cake 1.1. not just test suite. On Feb 17, 8:55 pm, Sam DeVore [EMAIL PROTECTED] wrote: Look inhttp://cakeforge.org === Http://blog.samdevore.com On Feb 17, 2008, at 8:28 AM, Jay [EMAIL PROTECTED] wrote: Hello, Can any body provide me cakephp 1.1 with integrated test suite 1.1. Your help will highly appreciated. Thank you. Regards, Jahangir -- -- (the old fart) the advice is free, the lack of crankiness will cost you - its a fine line between a real question and an idiot http://blog.samdevore.com/archives/2007/03/05/when-open-source-bugs-me/http://blog.samdevore.com/cakephp-pages/my-cake-wont-bake/http://blog.samdevore.com/cakephp-pages/i-cant-bake/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP test suite
This value should be set in the index.php of your webroot. You have to adjust it to the path of the cake core libs, it should be already there in the defaut app, unless you commented it? On Jul 2, 9:14 am, chanh.ong [EMAIL PROTECTED] wrote: I download CakePHP test suite and trying to use it but getting some error and not sure whether I am not setting that correctly or this test suite is not compatible with Cake 1.2alpha. Here is the error that I got: Notice: Use of undefined constant CORE_PATH - assumed 'CORE_PATH' in / home/groups/c/co/coaddons/htdocs/caketest/cake/config/paths.php on line 44 CakePHP Test Suite v 1.0.0.0 Any suggestion? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP test suite
I found out that the test suite 1.2 already include there. I was trying to run test suite 1.0 on 1.2 which not compatible I guess. On Jul 2, 9:38 am, francky06l [EMAIL PROTECTED] wrote: This value should be set in the index.php of your webroot. You have to adjust it to the path of the cake core libs, it should be already there in the defaut app, unless you commented it? On Jul 2, 9:14 am, chanh.ong [EMAIL PROTECTED] wrote: I download CakePHP test suite and trying to use it but getting some error and not sure whether I am not setting that correctly or this test suite is not compatible with Cake 1.2alpha. Here is the error that I got: Notice: Use of undefined constant CORE_PATH - assumed 'CORE_PATH' in / home/groups/c/co/coaddons/htdocs/caketest/cake/config/paths.php on line 44 CakePHP Test Suite v 1.0.0.0 Any suggestion? Thanks --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
CakePHP Test Suite
Hi, I'm new to CakePHP and would like to use Larry Masters's test suite to implement unit and regression testing in my project. I haven't found any documentation so maybe somebody on this list can give me some hints. What I have: - PHP5 - CakePHP 1.1.13.4450 - CakePHP Test Suite V. 1.0.0.0 I have found some doc on writing test cases in the SimpleTest folders. I have even figured out how to display the tests page in my browser but none of the links on this page works. All I get is Missing controller errors. After creating a dummy test group for my app it finally showed up in the list of available App test groups. But neither this link nor the link for All groups works (URL /tests/groups was not found on this server). Am I doing something wrong or do I have to use more recent packages? Where would I place my test classes for app? In the /app/tests/app/ cases folder or in one of the subfolders? Are there any samples how to write test cases / test groups for the testing framework? The only thing I found was the dispatcher.test.php. Thanks in advance for your help, Roger --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP Test Suite
Hi Roger, On 3/8/07, Roger [EMAIL PROTECTED] wrote: (URL /tests/groups was not found on this server). It's best to use the test suite from outside the framework. This can be done as follows by avoiding the 'TestsController' by calling the URL as follows: URL /test/groups ---(leave out the 's' in 'tests') To make a group test you must already have your unit tests defined. I can't remember the exact code to add them cause I haven't any groups defined in my current project and don't have the code here. Try the above anyway for a start. Cheers, Sonic Am I doing something wrong or do I have to use more recent packages? Where would I place my test classes for app? In the /app/tests/app/ cases folder or in one of the subfolders? Are there any samples how to write test cases / test groups for the testing framework? The only thing I found was the dispatcher.test.php. Thanks in advance for your help, Roger --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: CakePHP Test Suite -- 'Inflector' not found
On 9/29/06, Brian Wisti [EMAIL PROTECTED] wrote: Now that everything is basically working as advertised, it looks likeI'm going to experiment with the ModelUnitTestCase class athttp://cakephp.org/pastes/show/99b95734fbb3b5a90d9b20adbc381aa9 tostreamline the test database interaction. Hi Brian, That class was meant to show an idea and thus was a rough prototype. It only works with MySql and so isn't very cake-ish. I've since updated it to be more cake friendly. Although it works, it's nowhere near completion yet. Here's a link to the current version: http://cakephp.org/pastes/show/179781aca0867c288fb43d121519c43f I haven't had a chance to finish it cause I've been seriously busy lately. If you make any changes let me know as I'd be interested to see them. Cheers, Sonic --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: CakePHP Test Suite -- 'Inflector' not found
On 9/28/06, Sonic Baker [EMAIL PROTECTED] wrote: Hi Brian, maybe this will be of hekp to you: http://groups.google.ie/group/cake-php/browse_thread/thread/8815708bcb1c8b/c054815ad5d09804?lnk=gstq=test+suiternum=1#c054815ad5d09804 Cheers, Sonic It was helpful, but not in the way I expected. I got a 404 when I tried for /tests/, so I took a closer look at my setup. I eventually realized that I never got around to changing AllowOverride None to AllowOverride All in my conf file for localhost when I added this new Cake App. Such a small thing, but so very important! Then there was a minor issue with the test links going nowhere: Core Test Cases went to '/cases' from '/tests', although the links were correct if I first manually went to '/tests/cases'. My temporary workaround was to change $groups and $cases on line 208-209 of /app/tests/tests.php to: $groups = '/tests/?show=groups'; $cases = '/tests/?show=cases; Not an ideal workaround, I'm sure, but it works. I can access my tests from /tests/ and no more worries about undefined constants. Now that everything is basically working as advertised, it looks like I'm going to experiment with the ModelUnitTestCase class at http://cakephp.org/pastes/show/99b95734fbb3b5a90d9b20adbc381aa9 to streamline the test database interaction. Kind Regards, Brian Wisti http://coolnamehere.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: CakePHP Test Suite -- 'Inflector' not found
On 9/28/06, Sonic Baker [EMAIL PROTECTED] wrote: Hi Brian, maybe this will be of hekp to you: http://groups.google.ie/group/cake-php/browse_thread/thread/8815708bcb1c8b/c054815ad5d09804?lnk=gstq=test+suiternum=1#c054815ad5d09804 Cheers, Sonic It was helpful, but not in the way I expected. I got a 404 when I tried for /tests/, so I took a closer look at my setup. I eventually realized that I never got around to changing AllowOverride None to AllowOverride All in my conf file for localhost when I added this new Cake App. Such a small thing, but so very important! Then there was a minor issue with the test links going nowhere: Core Test Cases went to '/cases' from '/tests', although the links were correct if I first manually went to '/tests/cases'. My temporary workaround was to change $groups and $cases on line 208-209 of /app/tests/tests.php to: $groups = '/tests/?show=groups'; $cases = '/tests/?show=cases; Not an ideal workaround, I'm sure, but it works. I can access my tests from /tests/ and no more worries about undefined constants. Now that everything is basically working as advertised, it looks like I'm going to experiment with the ModelUnitTestCase class at http://cakephp.org/pastes/show/99b95734fbb3b5a90d9b20adbc381aa9 to streamline the test database interaction. Kind Regards, Brian Wisti http://coolnamehere.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---
Re: CakePHP Test Suite -- 'Inflector' not found
A little update. I removed my CORE_PATH entry with no apparent ill effects. I'm not sure why I thought I needed that. The Class not found issues were resolved by calling use() in my test case setUp() method. I needed both Inflector and Configure, so the call ended up being: uses(Inflector, Configure); Doesn't seem like the absolute smoothest approach, but I still have the feeling I'm approaching this from the wrong angle. Now there's an error message about not being able to open APP_PATHconfig/bootstrap.php, but I've already seen and dealt with a similar error. I think it just needs a DS wedged in there. Still, if anybody can offer a better way to test my models, I'd be grateful. Kind Regards, Brian Wisti http://coolnamehere.com/ --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups Cake PHP group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cake-php -~--~~~~--~~--~--~---