Akelos Framework v1 forum archive. This forum is no longer maintained. To report bugs please visit https://github.com/akelos/akelos/issues
    • CommentAuthorbhembree
     
    Can someone walk me through the unit testing process. I have created a .yaml file which resides in fixtures/app/models. I have created a unit test case file in unit/app/models. In that file I have delcared:

    var $fixtures = 'yaml file name';

    there is also the the setup method at the start of the file. It doesn't look like my yaml file data is getting loaded into the database.

    I am using version 0.8 of Akelos.

    Barry
    • CommentAuthorKaste
     

    first class BlahTest extends AkUnitTest

    so you get $this->installAndIncludeModels(...);

    this method accepts as the last argument some options.

    $options=array('populate'=>true);

    will search in fixtures/data for a yaml-file.
    You get an instance of the model at $this->ModelName.

    • CommentAuthorbhembree
     
    Thanks Kaste,

    I've done that. Is there a command to remove the data when the test is finished running. If I run the test a second time I get collision errors. I am also getting an error that looks like it has something to do with migration as follows:

    Can't go up to version 2, already at version 2.
    • CommentAuthorKaste
     

    installAndIncludeModels should uninstall and then reinstall the model. so when it can't go up, it probably wasn't down.

    • CommentAuthordemaio
     
    On the second post of this topic ... kaste wrote:

    so you get
    $this->installAndIncludeModels(...);

    this method accepts as the last argument some options.

    $options=array('populate'=>true);

    will search in fixtures/data for a yaml-file.
    You get an instance of the model at
    $this->ModelName

    ---------
    I have Test model (i know strange name , but it is working ;)
    I have added : 'populate'=>true to $this->installAndIncludeModels(...) as the last argument as adviced ...
    I have created a tests.yml file for that model in fixtures/data dir ... but it is not loaded to my project_test database .
    So I still can't test my models with AkSimpleTest and fixtures ...
    What am I doing wrong ?

    best regards
    demiao