Fixture Data Is Null When Trying To Get The Objects

I have the following test file


class DisplayAlbumTest extends CDbTestCase


  public $fixtures = array(

    'displayalbums' => 'DisplayAlbum',

    'displayphotos' => 'DisplayPhoto',



   * Get title


   * @group v1.0

   * @group now


  public function testGetTitle()


    $oAlbum = $this->displayalbums('get_title');



    $this->assertEquals('Get title test', $oAlbum->getTitle());



and its associated fixture file


return array(

  'get_title' => array(

    'title' => 'Get title test'



and the following config


Yii::setPathOfAlias('api', '../api/');

return CMap::mergeArray(







      /* uncomment the following to provide test database connection


        'connectionString'=>'DSN for test database',







The data is inserted into the database when running the tests but the var_dump prints NULL. If I try to access any methods on the model I get the following error (because I’m trying to access a method on NULL)

PHP Fatal error:  Call to a member function getTitle() on a non-object 

Other tests for other models with different fixtures work without any problem, but those that use the same fixture as this model test case fail.

If I do var_dump($this->displayalbums) inside the test this is the result that I get:

array(1) {


  array(2) {


    string(14) "Get title test"


    string(1) "1"



I could create new objects with the data from the array and test the methods but that would mean I’d have to rewrite all of my tests (others in this file are failing because of this) and it’s weird because I use this method in other tests that do not fail.

Why is the value NULL when I try to access the items from the fixture ?


I looked in the MySQL logs and the last query ran was the one to select the album I wanted

SELECT * FROM `DisplayAlbum` `t` WHERE `t`.`displayalbumid`=60 LIMIT 1

If I run the query it returns the proper result so the problem is not with the DB.