Tests for tinymvc
<p>Consider a controller named user with the following code
    

<pre><code>class User_Controller extends TinyMVC_Controller
{
  function index()
  {

    $oUserEntity = new User_Entity_Model();
    $oUserEntity-&gt;guid = 1;
    $oUserEntity-&gt;name = 'aaaaaa';
    $oUserEntity-&gt;username = 'aaaaaaa';
    $oUserEntity-&gt;password = 'newnew';
    $oUserEntity-&gt;email = 'aaaaaa@gmail.com';
    $oUserEntity-&gt;language = 'en';
    $oUserEntity-&gt;code = 'xyz';

    $oUserEntity-&gt;save();

  }
}

?&gt;
</code></pre>

<p>and its corresponding model named user_entity_model.php,</p>

<pre><code>&lt;?php
class User_Entity_Model extends Entity_Model 
{
/* some code..*/
public function save() {

        // Save generic stuff
    if (!parent::save()) {
        return false;
    }

    // Now save specific stuff
    return $this-&gt;create_user_entity($this-&gt;get('guid'), $this-&gt;get('name'), $this-&gt;get('username'),
    $this-&gt;get('password'), $this-&gt;get('email'), $this-&gt;get('language'), $this-&gt;get('code'));
}

public function create_user_entity($guid, $name, $username, $password,$email, $language, $code) {
    global $CONFIG;

$guid = (int)$guid;

$query = "INSERT into users_entity
            (guid, name, username, password, sapcode, salt, email, language, code) values ($guid, '$name', '$username', '$password',  '$email', '$language', '$code')";

$result = $this-&gt;db-&gt;query($query);
return $guid;

}

}
</code></pre>

<p>I used simpletest for testing the code. So,to test the function save(), i created tests folder and the test file userEntityTest.php
    

<pre><code>class userEntityTest extends UnitTestCase
{

    function testSave(){

    $oUserEntity = new User_Entity_Model();
    $oUserEntity-&gt;guid = 1;
    $oUserEntity-&gt;name = 'aaaa';
    $oUserEntity-&gt;username = 'aaaa';
    $oUserEntity-&gt;password = 'newnew';
    $oUserEntity-&gt;email = 'cool123@gmail.com';
    $oUserEntity-&gt;language = 'en';
    $oUserEntity-&gt;code = 'xyz';
    $guid = $oUserEntity-&gt;save();
    $cp = new UnitTestCase();   
    $cp-&gt;AssertNotEqual($guid, 0);
}
</code></pre>

<p>}</p>

<p>I got the following error when i executed the test in browser</p>

<blockquote>
  <p>( ! ) Fatal error: Class 'Entity_Model' not found in C:\wamp\www\career portal\tinymvc\myapp\models\user_entity_model.php on line 3</p>
  
  <p>userEntityTest.php
  Fail: -> Bad TestSuite [userEntityTest.php] with error [No runnable test cases in [userEntityTest.php]]
  0/0 test cases complete: 0 passes, 1 fails and 0 exceptions.</p>
</blockquote>

<p>Please help me to successfully run the tests.</p>
