【发布时间】:2017-04-08 23:54:27
【问题描述】:
我的代码中有这样的方法。
public function businessDepartments()
{
$this->paginate = [
'conditions' => [
'Tags.tag_type_id' => 'businessDepartment'
]
];
parent::_index();
$this->set('columns', [
'tag_value' => ['title' => __d('cockpit', 'Business department')],
'sort' => ['title' => __d('cockpit', 'Sorting')]
]);
$this->_setURLsWhenAdd();
}
我可以使用类“Tags”和操作“businessDepartment”来调用此方法。 这就是 _setURLWhenAdd() 的样子。
/**
* this method is setting the URLs inside the add
* @return setter
*/
protected function _setURLsWhenAdd()
{
// Set a new Url for the Add-Button in the index-View
$this->set('dataAjaxUrl', "/tags/add/businessDepartment");
// Sets the refreshable-Class on the element and the ajax-url where the element can get fresh data
$this->set('refreshable', '/tags/businessDepartments');
}
我有一个看起来像这样的测试。
public function testBusinessDepartments()
{
$this->get('/tags/businessDepartments');
$this->assertResponseOk();
}
这是我想要测试的吗?我可以/应该测试更多的东西吗?除了这个方法的入口和响应?
【问题讨论】: