Fixture Data Is Null When Trying To Get The Objects

I have the following test file




<?php


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');


    var_dump($oAlbum);


    die('nope!');


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

  }


}

and its associated fixture file




<?php

return array(

  'get_title' => array(

    'title' => 'Get title test'

  )

);

and the following config




<?php

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


return CMap::mergeArray(

  require(dirname(__FILE__).'/main.php'),

  array(

    'components'=>array(

      'fixture'=>array(

        'class'=>'system.test.CDbFixtureManager',

      ),

      /* uncomment the following to provide test database connection

      'db'=>array(

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

      ),

      */

      'db'=>$TEST_DB_SETTINGS,

    ),

  )

);



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) {

  ["get_title"]=>

  array(2) {

    ["title"]=>

    string(14) "Get title test"

    ["displayalbumid"]=>

    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 ?

Edit:

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.