Class not found error when running unit test on a plugin service I am writing a plugin and want to unit test my services.  I am following the example given here: https://github.com/amacneil/cocktailrecipes. The problem is when I run my application, I get a

PHP Fatal Error: Class 'TournamentData_IndividualService' not found.


Here is the problem portion of the test code:

&lt;?php
namespace Craft;

use \Mockery as m;
use PHPUnit_Framework_TestCase;

class TournamentData_IndividualServiceTest extends PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        $this-&gt;ingredientRecord = m::mock('Craft\TournamentData_IndividualRecord');
        $this-&gt;service = new TournamentData_IndividualService($this-&gt;ingredientRecord);
    }
}


Here is my service code:

&lt;?php
namespace Craft;

class TournamentData_IndividualService extends BaseApplicationComponent
{
    protected $individualRecord;

    public function __construct($individualRecord = null)
    {
        $this-&gt;individualRecord = $individualRecord;
        if(is_null($this-&gt;individualRecord)) {
            $this-&gt;individualRecord = TournamentData_IndividualRecord::model();
        }
    }
}


One more note, just in case this has the answer to what I'm looking for, I have taken a look at https://github.com/selvinortiz/craft.loath, but I wasn't able to follow what its setup code was accomplishing.

Any help is greatly appreciated!
I figured out the problem, I needed to load in the service, and then my service needed to load in the model and record. So for the test code, I added the function:

protected function loadServices()
{
    require_once __DIR__ . '/../services/TournamentData_IndividualService.php';
}


Then for my setUp function, it became:

&lt;?php
namespace Craft;

use \Mockery as m;
use PHPUnit_Framework_TestCase;
class TournamentData_IndividualServiceTest extends PHPUnit_Framework_TestCase
{
    public function setUp()
    {
        $this-&gt;loadServices();
        $this-&gt;ingredientRecord = m::mock('Craft\TournamentData_IndividualRecord');
        $this-&gt;service = new TournamentData_IndividualService($this-&gt;ingredientRecord);
    }
}


Then in my service method, I added require statements for the model and record like so:

&lt;?php

require_once __DIR__ . '/../models/TournamentData_IndividualModel.php';
require_once __DIR__ . '/../records/TournamentData_IndividualRecord.php';

namespace Craft;

class TournamentData_IndividualService extends BaseApplicationComponent
{
    protected $individualRecord;

    public function __construct($individualRecord = null)
    {
        $this-&gt;individualRecord = $individualRecord;
        if(is_null($this-&gt;individualRecord)) {
            $this-&gt;individualRecord = TournamentData_IndividualRecord::model();
        }
    }
}


Ironically, I managed to find the answer to my problem almost immediately after deciding to ask the community, but hopefully this helps somebody else in the future!