Я использую отличный плагин CakeDC Tags для своей модели Solutions:
class Solution extends AppModel {
public $actsAs = array(
'Tags.Taggable',
'Search.Searchable',
);
}
У меня есть метод SolutionsController::search():
App::uses('AppController', 'Controller');
class SolutionsController extends AppController {
public $components = array(
'Paginator',
'Search.Prg',
);
public $presetVars = true; // using the 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');
}
Я пытаюсь написать тест для этого метода:
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 was granted to the one 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);
}
}
Я получаю эту ошибку при запуске теста: Отсутствует ошибка таблицы базы данных: теги таблицы для тега модели не найдены в тесте источника данных.
Я попытался скопировать приспособление тега плагина в папку Test/fixtures моего приложения и включить его в качестве приспособления приложения. Я не могу запустить свой тест. Как мне заставить мой тест видеть фикстуру тегов из app\Plugin \tags\Test\Fixture\TagFixture.php и запустить?
CREATE TABLE
? - person boast   schedule 21.03.2014app\Plugin\tags
, береги кожух. Должна быть папка Теги. - person mark   schedule 22.03.2014