fix bug 83
This commit is contained in:
parent
02b6993615
commit
3d416f82bd
|
@ -16,7 +16,6 @@ use Respect\Validation\Validator as DataValidator;
|
||||||
* @apiParam {String} name Name of the new department.
|
* @apiParam {String} name Name of the new department.
|
||||||
*
|
*
|
||||||
* @apiUse NO_PERMISSION
|
* @apiUse NO_PERMISSION
|
||||||
* @apiUse INVALID_NAME
|
|
||||||
*
|
*
|
||||||
* @apiSuccess {Object} data Empty object
|
* @apiSuccess {Object} data Empty object
|
||||||
*
|
*
|
||||||
|
@ -29,12 +28,7 @@ class AddDepartmentController extends Controller {
|
||||||
public function validations() {
|
public function validations() {
|
||||||
return [
|
return [
|
||||||
'permission' => 'staff_3',
|
'permission' => 'staff_3',
|
||||||
'requestData' => [
|
'requestData' => []
|
||||||
'name' => [
|
|
||||||
'validation' => DataValidator::alnum(),
|
|
||||||
'error' => ERRORS::INVALID_NAME
|
|
||||||
]
|
|
||||||
]
|
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ describe'system/add-department' do
|
||||||
request('/user/logout')
|
request('/user/logout')
|
||||||
Scripts.login($staff[:email], $staff[:password], true)
|
Scripts.login($staff[:email], $staff[:password], true)
|
||||||
|
|
||||||
it 'should add department' do
|
it 'should add department with alphanumeric characters' do
|
||||||
result = request('/system/add-department', {
|
result = request('/system/add-department', {
|
||||||
csrf_userid: $csrf_userid,
|
csrf_userid: $csrf_userid,
|
||||||
csrf_token: $csrf_token,
|
csrf_token: $csrf_token,
|
||||||
|
@ -18,4 +18,21 @@ describe'system/add-department' do
|
||||||
lastLog = $database.getLastRow('log')
|
lastLog = $database.getLastRow('log')
|
||||||
(lastLog['type']).should.equal('ADD_DEPARTMENT')
|
(lastLog['type']).should.equal('ADD_DEPARTMENT')
|
||||||
end
|
end
|
||||||
|
|
||||||
|
it 'should add department with html tag' do
|
||||||
|
result = request('/system/add-department', {
|
||||||
|
csrf_userid: $csrf_userid,
|
||||||
|
csrf_token: $csrf_token,
|
||||||
|
name: '<b>new department</b>'
|
||||||
|
})
|
||||||
|
|
||||||
|
(result['status']).should.equal('success')
|
||||||
|
|
||||||
|
row = $database.getRow('department', 5, 'id')
|
||||||
|
|
||||||
|
(row['name']).should.equal('<b>new department</b>')
|
||||||
|
|
||||||
|
lastLog = $database.getLastRow('log')
|
||||||
|
(lastLog['type']).should.equal('ADD_DEPARTMENT')
|
||||||
|
end
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in New Issue