Hi all,

I've been having a grand time learning Cake over the last few weeks,
but the fun seems to have had a hiccup now that I'm trying to
incorporate unit testing into my simple blog app. I'm not sure if it's
because I'm using Models wrong or the CakePHP test libraries wrong.
Would somebody mind helping me out with a little advice or happy link?

This is just an exploration of testing via CakePHP, so the model and
test are both pretty minimal:

post.php:

<?php

class Post extends AppModel
{
    var $name = 'Post';
}

?>

post.test.php:

<?php

class PostUnitTestCase extends UnitTestCase
{

    function setUp()
    {
        loadModel("Post");
        $this->Post = new Post();
    }

    /**
     * Sanity check that basic post functionality works.
     */
    function testPost()
    {
        $data = array(
            'posted'  => '01/05/2005',
            'title'   => 'Dude!',
            'content' => "Where's my car?"
        );
        $this->assertTrue($this->Post->save($data), "New post saved.");
    }
}

?>

But the error message completely throws me off:

CakePHP Test Suite v 1.0.0.0
Individual test case: models/post.test.php

Fatal error: Class 'Inflector' not found in
/home/brianwisti/coolnamehere/cake/basics.php on line 144

Now, I did have to define CORE_PATH in app/tests/tests.php

if (!defined('CORE_PATH')){
        define('CORE_PATH', ROOT.DS);
}

In order to get things working at all. Should I have added another
definition in that file? I'm a little baffled at what I should be
doing to get a basic test up and running.

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 [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
-~----------~----~----~----~------~----~------~--~---

Reply via email to