cakephp - Include fixture from Tags plugin in app test -
i'm using excellent cakedc tags plugin on solutions model:
class solution extends appmodel { public $actsas = array( 'tags.taggable', 'search.searchable', ); }
i have solutionscontroller::search() method:
app::uses('appcontroller', 'controller'); class solutionscontroller extends appcontroller { public $components = array( 'paginator', 'search.prg', ); public $presetvars = true; // using model configuration ('search' plugin) public function search() { $this->prg->commonprocess(); $this->paginator->settings['conditions'] = $this->solution->parsecriteria($this->prg->parsedparams()); $solutions = $this->paginator->paginate(); if (!empty($solutions)) { $this->session->setflash('solutions found'); } else { $this->session->setflash('no solutions found'); } $this->set('solutions', $solutions); $this->render('index'); }
i'm trying write test method:
app::uses('solutionscontroller', 'controller'); class solutionscontrollertest extends controllertestcase { public $fixtures = array( 'app.solution', 'plugin.tags.tag' ); public function testsearchforoneresultshouldoutputtext() { $data = array('search' => 'fiery'); $result = $this->solution->search($data); debug($result); $expected = array( 'id' => 3, 'name' => 'fiery-colored horse', 'shortdesc' => 'war', 'body' => 'it granted 1 seated on it..', 'category_id' => 3, 'created_by' => 1, 'modified_by' => 1, 'created' => '2014-02-14 21:28:46', 'modified' => '2014-02-14 21:28:46' ); $this->assertcontains($expected); } }
i'm getting error when running test: missing database table error: table tags model tag not found in datasource test.
i've tried copying plugin tag fixture app test/fixtures folder , including app fixture. can't test run. how test see tags fixture app\plugin\tags\test\fixture\tagfixture.php , run?
problem turned out solutionsfixture, imported table schema , records, also included $records array (oops). re-baking fixture import neither schema nor records resolved error.
Comments
Post a Comment