GuilleSabe-ticket-seen[skip ci]

This commit is contained in:
Ivan Diaz 2016-10-20 18:34:06 -03:00
parent 44cf49c813
commit 20b3f6ebc0
3 changed files with 50 additions and 0 deletions

View File

@ -10,6 +10,7 @@ include 'ticket/change-department.php';
include 'ticket/close.php';
include 'ticket/re-open.php';
include 'ticket/change-priority.php';
include 'ticket/seen.php';
$ticketControllers = new ControllerGroup();
$ticketControllers->setGroupPath('/ticket');
@ -25,5 +26,6 @@ $ticketControllers->addController(new ChangeDepartmentController);
$ticketControllers->addController(new CloseController);
$ticketControllers->addController(new ReOpenController);
$ticketControllers->addController(new ChangePriorityController);
$ticketControllers->addController(new SeenController);
$ticketControllers->finalize();

View File

@ -0,0 +1,23 @@
<?php
use Respect\Validation\Validator as DataValidator;
class SeenController extends Controller {
const PATH = '/seen';
public function validations() {
return [
'permission' => 'user',
'requestData' => [
'ticketNumber' => [
'validation' => DataValidator::validTicketNumber(),
'error' => ERRORS::INVALID_TICKET
]
]
];
}
public function handler() {
$ticketnumber = Controller::request('ticketNumber');
}
}

25
tests/ticket/seen.rb Normal file
View File

@ -0,0 +1,25 @@
describe '/ticket/seen' do
describe 'when a staff is logged' do
request('/user/logout')
Scripts.login($staff[:email], $staff[:password], true)
it 'should change unread if everything is okey ' do
result = request('/ticket/seen', {
ticketNumber: ticket['ticket_number'],
csrf_userid: $csrf_userid,
csrf_token: $csrf_token
})
(result['status']).should.equal('success')
end
end
describe 'when a user is logged' do
it 'should change unread if everything is okey ' do
end
end
end