Re: Cakephp Model Testing
You need to update your test.php, get a fresh one from github. -Mark On Sep 15, 7:24 am, web developer wrote: > I am using cakephp 1.2 and would like to know how to do/use testing in > cakephp.I went through book.cakephp.org on testing (till model > testing). I hit a roadblock when i tried model testing. > > This is what i did > > A. Downloaded simpletest and added it in vendors folder > B. Created test connection in database.php > C. Set debug level to 2 in core > D. Copied core test files from cake git's /cake/tests to my app's / > cake/tests > E. Created Fixture > > class AirlineFixture extends CakeTestFixture { > var $name = 'Airline'; > var $import = 'Airline'; > var $records = array( > array ('id' => 1, 'name' => 'First Airline', 'type' => > 'all'), > array ('id' => 2, 'name' => 'Secd Airline', 'type' => > 'all'), > array ('id' => 3, 'name' => 'Third Airline', 'type' => > 'all') > ); > } > ?> > > F. Wrote test case > > App::import('Model', 'Airline'); > class AirlineTestCase extends CakeTestCase { > var $fixtures = array( 'app.Airline' ); > > function testPublished() { > $this->Airline =& ClassRegistry::init('Airline'); > $result = $this->Airline->published(array('id', 'name')); > $expected = array( > array ('id' => 1, 'name' => 'First Airline', 'type' => > 'all'), > array ('id' => 2, 'name' => 'Secd Airline', 'type' => > 'all'), > array ('id' => 3, 'name' => 'Third Airline', 'type' => > 'all') > ); > $this->assertEqual($result, $expected); > } > } > ?> > > G. I executeshttp://localhost/fsd/test.php. when i did it i got the > following error > > Fatal error: Call to undefined function CakePHPTestHeader() in /var/ > www/fsd/app/webroot/test.php on line 141 > > What wrong am i doing Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
Re: Cakephp Model Testing
Can you test from shell? $ cd path/to/app $ cake testsuite app case models/airline On Sep 15, 5:24 am, web developer wrote: > I am using cakephp 1.2 and would like to know how to do/use testing in > cakephp.I went through book.cakephp.org on testing (till model > testing). I hit a roadblock when i tried model testing. > > This is what i did > > A. Downloaded simpletest and added it in vendors folder > B. Created test connection in database.php > C. Set debug level to 2 in core > D. Copied core test files from cake git's /cake/tests to my app's / > cake/tests > E. Created Fixture > > class AirlineFixture extends CakeTestFixture { > var $name = 'Airline'; > var $import = 'Airline'; > var $records = array( > array ('id' => 1, 'name' => 'First Airline', 'type' => > 'all'), > array ('id' => 2, 'name' => 'Secd Airline', 'type' => > 'all'), > array ('id' => 3, 'name' => 'Third Airline', 'type' => > 'all') > ); > } > ?> > > F. Wrote test case > > App::import('Model', 'Airline'); > class AirlineTestCase extends CakeTestCase { > var $fixtures = array( 'app.Airline' ); > > function testPublished() { > $this->Airline =& ClassRegistry::init('Airline'); > $result = $this->Airline->published(array('id', 'name')); > $expected = array( > array ('id' => 1, 'name' => 'First Airline', 'type' => > 'all'), > array ('id' => 2, 'name' => 'Secd Airline', 'type' => > 'all'), > array ('id' => 3, 'name' => 'Third Airline', 'type' => > 'all') > ); > $this->assertEqual($result, $expected); > } > } > ?> > > G. I executeshttp://localhost/fsd/test.php. when i did it i got the > following error > > Fatal error: Call to undefined function CakePHPTestHeader() in /var/ > www/fsd/app/webroot/test.php on line 141 > > What wrong am i doing Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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
Re: Cakephp Model Testing
Any answers/solutions ??? Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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 Model Testing
I am using cakephp 1.2 and would like to know how to do/use testing in cakephp.I went through book.cakephp.org on testing (till model testing). I hit a roadblock when i tried model testing. This is what i did A. Downloaded simpletest and added it in vendors folder B. Created test connection in database.php C. Set debug level to 2 in core D. Copied core test files from cake git's /cake/tests to my app's / cake/tests E. Created Fixture 1, 'name' => 'First Airline', 'type' => 'all'), array ('id' => 2, 'name' => 'Secd Airline', 'type' => 'all'), array ('id' => 3, 'name' => 'Third Airline', 'type' => 'all') ); } ?> F. Wrote test case Airline =& ClassRegistry::init('Airline'); $result = $this->Airline->published(array('id', 'name')); $expected = array( array ('id' => 1, 'name' => 'First Airline', 'type' => 'all'), array ('id' => 2, 'name' => 'Secd Airline', 'type' => 'all'), array ('id' => 3, 'name' => 'Third Airline', 'type' => 'all') ); $this->assertEqual($result, $expected); } } ?> G. I executes http://localhost/fsd/test.php . when i did it i got the following error Fatal error: Call to undefined function CakePHPTestHeader() in /var/ www/fsd/app/webroot/test.php on line 141 What wrong am i doing Check out the new CakePHP Questions site http://cakeqs.org and help others with their CakePHP related questions. 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