guillermo- path- staff-get-ticket [skip ci]
This commit is contained in:
parent
a42e00ad9b
commit
59099a3bbf
|
@ -2,6 +2,7 @@
|
|||
require_once 'staff/get.php';
|
||||
require_once 'staff/assign-ticket.php';
|
||||
require_once 'staff/un-assign-ticket.php';
|
||||
require_once 'staff/get-tickets.php';
|
||||
|
||||
$systemControllerGroup = new ControllerGroup();
|
||||
$systemControllerGroup->setGroupPath('/staff');
|
||||
|
@ -9,5 +10,6 @@ $systemControllerGroup->setGroupPath('/staff');
|
|||
$systemControllerGroup->addController(new GetStaffController);
|
||||
$systemControllerGroup->addController(new AssignStaffController);
|
||||
$systemControllerGroup->addController(new UnAssignStaffController);
|
||||
$systemControllerGroup->addController(new GetTicketStaffController);
|
||||
|
||||
$systemControllerGroup->finalize();
|
|
@ -0,0 +1,18 @@
|
|||
<?php
|
||||
use Respect\Validation\Validator as DataValidator;
|
||||
|
||||
class GetTicketStaffController extends Controller {
|
||||
const PATH = '/get-tickets';
|
||||
|
||||
public function validations() {
|
||||
return [
|
||||
'permission' => 'staff_1',
|
||||
'requestData' => []
|
||||
];
|
||||
}
|
||||
|
||||
public function handler() {
|
||||
$user = Controller::getLoggedUser();
|
||||
Response::respondSuccess($user->sharedTicketList->toArray());
|
||||
}
|
||||
}
|
|
@ -25,3 +25,4 @@ require './ticket/custom-response.rb'
|
|||
require './staff/get.rb'
|
||||
require './staff/assign-ticket.rb'
|
||||
require './staff/un-assign-ticket.rb'
|
||||
require './staff/get-tickets.rb'
|
||||
|
|
|
@ -0,0 +1,26 @@
|
|||
describe '/staff/get-tickets' do
|
||||
request('/user/logout')
|
||||
Scripts.login($staff[:email], $staff[:password], true)
|
||||
|
||||
it 'should get ticket list' do
|
||||
|
||||
ticket = $database.getRow('ticket', 1 , 'id')
|
||||
request('/staff/assign-ticket', {
|
||||
ticketNumber: ticket['ticket_number'],
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
})
|
||||
ticket = $database.getRow('ticket', 2 , 'id')
|
||||
request('/staff/assign-ticket', {
|
||||
ticketNumber: ticket['ticket_number'],
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
})
|
||||
result = request('/staff/get-tickets', {
|
||||
csrf_userid: $csrf_userid,
|
||||
csrf_token: $csrf_token
|
||||
})
|
||||
|
||||
(result['status']).should.equal('success')
|
||||
end
|
||||
end
|
Loading…
Reference in New Issue