示例#1
0
 public function testDeleteTicket()
 {
     $this->assertEquals(200, $this->call('post', 'v1/tickets/', factory(Ticket::class)->make()->toarray())->status());
     //add ticket
     $ticket = Ticket::orderBy('id', 'desc')->first();
     $ticketId = $ticket->id;
     $zendeskTicketId = $ticket->zendesk_ticket_id;
     $this->assertEquals(200, $this->call('delete', 'v1/tickets/' . $ticketId)->status());
     //find and delete
     $updatedTicketStatus = 404;
     if (Zendesk::tickets($zendeskTicketId)->find()->ticket->status == "solved") {
         $updatedTicketStatus = 200;
     }
     $this->assertEquals(200, $updatedTicketStatus);
     Zendesk::ticket($zendeskTicketId)->delete();
     //delete ticket after
     $this->assertEquals(404, $this->call('delete', 'v1/tickets/' . $ticketId)->status());
     //find deleted one
 }
示例#2
0
<?php

/*
|--------------------------------------------------------------------------
| Application Routes
|--------------------------------------------------------------------------
|
| Here is where you can register all of the routes for an application.
| It's a breeze. Simply tell Laravel the URIs it should respond to
| and give it the controller to call when that URI is requested.
|
*/
Route::group(['prefix' => 'v1'], function () {
    Route::get('/tickets', 'TicketController@index');
    Route::get('/tickets/{id}', 'TicketController@getIndividual');
    Route::post('/tickets', 'TicketController@create');
    Route::delete('/tickets/{id}', 'TicketController@delete');
    Route::get('/statistic', 'TicketController@getStatistic');
});
Route::get('/', function () {
    var_dump(Zendesk::tickets(63699)->find()->ticket->status);
});