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

 <?php
   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

 <?php
    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 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 [email protected]
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

Reply via email to