Basic ticket creator appears to be working. Still need to handle email
This commit is contained in:
parent
c8485c0fa3
commit
ca499d5eac
@ -13,6 +13,7 @@ use BusinessLogic\Tickets\TrackingIdGenerator;
|
|||||||
use DataAccess\Categories\CategoryGateway;
|
use DataAccess\Categories\CategoryGateway;
|
||||||
use DataAccess\Security\BanGateway;
|
use DataAccess\Security\BanGateway;
|
||||||
use DataAccess\Security\UserGateway;
|
use DataAccess\Security\UserGateway;
|
||||||
|
use DataAccess\Statuses\StatusGateway;
|
||||||
use DataAccess\Tickets\TicketGateway;
|
use DataAccess\Tickets\TicketGateway;
|
||||||
|
|
||||||
|
|
||||||
@ -35,6 +36,7 @@ class ApplicationContext {
|
|||||||
$this->get[BanRetriever::class] = new BanRetriever($this->get[BanGateway::class]);
|
$this->get[BanRetriever::class] = new BanRetriever($this->get[BanGateway::class]);
|
||||||
|
|
||||||
// Tickets
|
// Tickets
|
||||||
|
$this->get[StatusGateway::class] = new StatusGateway();
|
||||||
$this->get[TicketGateway::class] = new TicketGateway();
|
$this->get[TicketGateway::class] = new TicketGateway();
|
||||||
$this->get[TicketRetriever::class] = new TicketRetriever($this->get[TicketGateway::class]);
|
$this->get[TicketRetriever::class] = new TicketRetriever($this->get[TicketGateway::class]);
|
||||||
$this->get[TicketValidators::class] = new TicketValidators($this->get[TicketGateway::class]);
|
$this->get[TicketValidators::class] = new TicketValidators($this->get[TicketGateway::class]);
|
||||||
@ -46,6 +48,7 @@ class ApplicationContext {
|
|||||||
$this->get[TicketCreator::class] = new TicketCreator($this->get[NewTicketValidator::class],
|
$this->get[TicketCreator::class] = new TicketCreator($this->get[NewTicketValidator::class],
|
||||||
$this->get[TrackingIdGenerator::class],
|
$this->get[TrackingIdGenerator::class],
|
||||||
$this->get[Autoassigner::class],
|
$this->get[Autoassigner::class],
|
||||||
|
$this->get[StatusGateway::class],
|
||||||
$this->get[TicketGateway::class]);
|
$this->get[TicketGateway::class]);
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -18,5 +18,19 @@ class DefaultStatusForAction {
|
|||||||
const REOPENED_BY_STAFF = "IsStaffReopenedStatus";
|
const REOPENED_BY_STAFF = "IsStaffReopenedStatus";
|
||||||
const DEFAULT_STAFF_REPLY = "IsDefaultStaffReplyStatus";
|
const DEFAULT_STAFF_REPLY = "IsDefaultStaffReplyStatus";
|
||||||
const LOCKED_TICKET = "LockedTicketStatus";
|
const LOCKED_TICKET = "LockedTicketStatus";
|
||||||
const AUTOCLOSE_STATUS = "IsAutoCloseOption";
|
const AUTOCLOSE_STATUS = "IsAutocloseOption";
|
||||||
|
|
||||||
|
static function getAll() {
|
||||||
|
return array(
|
||||||
|
self::NEW_TICKET,
|
||||||
|
self::CLOSED_STATUS,
|
||||||
|
self::CLOSED_BY_CLIENT,
|
||||||
|
self::CUSTOMER_REPLY,
|
||||||
|
self::CLOSED_BY_STAFF,
|
||||||
|
self::REOPENED_BY_STAFF,
|
||||||
|
self::DEFAULT_STAFF_REPLY,
|
||||||
|
self::LOCKED_TICKET,
|
||||||
|
self::AUTOCLOSE_STATUS
|
||||||
|
);
|
||||||
|
}
|
||||||
}
|
}
|
@ -4,6 +4,42 @@ namespace BusinessLogic\Statuses;
|
|||||||
|
|
||||||
|
|
||||||
class Status {
|
class Status {
|
||||||
|
static function fromDatabase($row, $languageRs) {
|
||||||
|
$status = new Status();
|
||||||
|
$status->id = $row['ID'];
|
||||||
|
$status->textColor = $row['TextColor'];
|
||||||
|
$status->defaultActions = array();
|
||||||
|
|
||||||
|
foreach (DefaultStatusForAction::getAll() as $defaultStatus) {
|
||||||
|
$status = self::addDefaultStatusIfSet($status, $row, $defaultStatus);
|
||||||
|
}
|
||||||
|
|
||||||
|
$status->closable = $row['Closable'];
|
||||||
|
|
||||||
|
$localizedLanguages = array();
|
||||||
|
while ($languageRow = hesk_dbFetchAssoc($languageRs)) {
|
||||||
|
$localizedLanguages[] = new StatusLanguage($languageRow['language'], $languageRow['text']);
|
||||||
|
}
|
||||||
|
$status->localizedNames = $localizedLanguages;
|
||||||
|
$status->sort = $row['sort'];
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param $status Status
|
||||||
|
* @param $row array
|
||||||
|
* @param $key string
|
||||||
|
* @return Status
|
||||||
|
*/
|
||||||
|
private static function addDefaultStatusIfSet($status, $row, $key) {
|
||||||
|
if ($row[$key]) {
|
||||||
|
$status->defaultActions[] = $key;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $status;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var $id int
|
* @var $id int
|
||||||
*/
|
*/
|
||||||
@ -30,7 +66,7 @@ class Status {
|
|||||||
public $sort;
|
public $sort;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var $name string[]
|
* @var $name StatusLanguage[]
|
||||||
*/
|
*/
|
||||||
public $localizedNames;
|
public $localizedNames;
|
||||||
}
|
}
|
20
api/BusinessLogic/Statuses/StatusLanguage.php
Normal file
20
api/BusinessLogic/Statuses/StatusLanguage.php
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
/**
|
||||||
|
* Created by PhpStorm.
|
||||||
|
* User: mkoch
|
||||||
|
* Date: 2/16/2017
|
||||||
|
* Time: 8:53 PM
|
||||||
|
*/
|
||||||
|
|
||||||
|
namespace BusinessLogic\Statuses;
|
||||||
|
|
||||||
|
|
||||||
|
class StatusLanguage {
|
||||||
|
public $language;
|
||||||
|
public $text;
|
||||||
|
|
||||||
|
function __construct($language, $text) {
|
||||||
|
$this->language = $language;
|
||||||
|
$this->text = $text;
|
||||||
|
}
|
||||||
|
}
|
@ -3,6 +3,8 @@
|
|||||||
namespace BusinessLogic\Tickets;
|
namespace BusinessLogic\Tickets;
|
||||||
|
|
||||||
use BusinessLogic\Exceptions\ValidationException;
|
use BusinessLogic\Exceptions\ValidationException;
|
||||||
|
use BusinessLogic\Statuses\DefaultStatusForAction;
|
||||||
|
use DataAccess\Statuses\StatusGateway;
|
||||||
use DataAccess\Tickets\TicketGateway;
|
use DataAccess\Tickets\TicketGateway;
|
||||||
|
|
||||||
class TicketCreator {
|
class TicketCreator {
|
||||||
@ -21,15 +23,21 @@ class TicketCreator {
|
|||||||
*/
|
*/
|
||||||
private $autoassigner;
|
private $autoassigner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var $statusGateway StatusGateway
|
||||||
|
*/
|
||||||
|
private $statusGateway;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var $ticketGateway TicketGateway
|
* @var $ticketGateway TicketGateway
|
||||||
*/
|
*/
|
||||||
private $ticketGateway;
|
private $ticketGateway;
|
||||||
|
|
||||||
function __construct($newTicketValidator, $trackingIdGenerator, $autoassigner, $ticketGateway) {
|
function __construct($newTicketValidator, $trackingIdGenerator, $autoassigner, $statusGateway, $ticketGateway) {
|
||||||
$this->newTicketValidator = $newTicketValidator;
|
$this->newTicketValidator = $newTicketValidator;
|
||||||
$this->trackingIdGenerator = $trackingIdGenerator;
|
$this->trackingIdGenerator = $trackingIdGenerator;
|
||||||
$this->autoassigner = $autoassigner;
|
$this->autoassigner = $autoassigner;
|
||||||
|
$this->statusGateway = $statusGateway;
|
||||||
$this->ticketGateway = $ticketGateway;
|
$this->ticketGateway = $ticketGateway;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,10 +84,25 @@ class TicketCreator {
|
|||||||
$ticket->ipAddress = $ticketRequest->ipAddress;
|
$ticket->ipAddress = $ticketRequest->ipAddress;
|
||||||
$ticket->language = $ticketRequest->language;
|
$ticket->language = $ticketRequest->language;
|
||||||
|
|
||||||
|
$status = $this->statusGateway->getStatusForDefaultAction(DefaultStatusForAction::NEW_TICKET, $heskSettings);
|
||||||
|
|
||||||
|
if ($status === null) {
|
||||||
|
throw new \Exception("Could not find the default status for a new ticket!");
|
||||||
|
}
|
||||||
|
$ticket->statusId = $status->id;
|
||||||
|
|
||||||
$ticketGatewayGeneratedFields = $this->ticketGateway->createTicket($ticket, $heskSettings);
|
$ticketGatewayGeneratedFields = $this->ticketGateway->createTicket($ticket, $heskSettings);
|
||||||
|
|
||||||
$ticket->dateCreated = $ticketGatewayGeneratedFields->dateCreated;
|
$ticket->dateCreated = $ticketGatewayGeneratedFields->dateCreated;
|
||||||
$ticket->lastChanged = $ticketGatewayGeneratedFields->dateModified;
|
$ticket->lastChanged = $ticketGatewayGeneratedFields->dateModified;
|
||||||
|
$ticket->archived = false;
|
||||||
|
$ticket->locked = false;
|
||||||
|
$ticket->id = $ticketGatewayGeneratedFields->id;
|
||||||
|
$ticket->openedBy = 0;
|
||||||
|
$ticket->numberOfReplies = 0;
|
||||||
|
$ticket->numberOfStaffReplies = 0;
|
||||||
|
$ticket->timeWorked = '00:00:00';
|
||||||
|
$ticket->lastReplier = 0;
|
||||||
|
|
||||||
return $ticket;
|
return $ticket;
|
||||||
}
|
}
|
||||||
|
@ -10,6 +10,7 @@ namespace BusinessLogic\Tickets;
|
|||||||
|
|
||||||
|
|
||||||
class TicketGatewayGeneratedFields {
|
class TicketGatewayGeneratedFields {
|
||||||
|
public $id;
|
||||||
public $dateCreated;
|
public $dateCreated;
|
||||||
public $dateModified;
|
public $dateModified;
|
||||||
}
|
}
|
@ -5,15 +5,31 @@ namespace DataAccess\Statuses;
|
|||||||
|
|
||||||
use BusinessLogic\Statuses\DefaultStatusForAction;
|
use BusinessLogic\Statuses\DefaultStatusForAction;
|
||||||
use BusinessLogic\Statuses\Status;
|
use BusinessLogic\Statuses\Status;
|
||||||
|
use DataAccess\CommonDao;
|
||||||
|
|
||||||
class StatusGateway {
|
class StatusGateway extends CommonDao {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param $defaultAction DefaultStatusForAction
|
* @param $defaultAction string
|
||||||
* @return Status
|
* @return Status
|
||||||
*/
|
*/
|
||||||
function getStatusForDefaultAction($defaultAction) {
|
function getStatusForDefaultAction($defaultAction, $heskSettings) {
|
||||||
//-- TODO
|
$this->init();
|
||||||
return new Status();
|
|
||||||
|
$metaRs = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($heskSettings['db_pfix']) . 'statuses`
|
||||||
|
WHERE `' . $defaultAction . '` = 1');
|
||||||
|
if (hesk_dbNumRows($metaRs) === 0) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
$row = hesk_dbFetchAssoc($metaRs);
|
||||||
|
|
||||||
|
$languageRs = hesk_dbQuery('SELECT * FROM `' . hesk_dbEscape($heskSettings['db_pfix']) . 'text_to_status_xref`
|
||||||
|
WHERE `status_id` = ' . intval($row['ID']));
|
||||||
|
|
||||||
|
$status = Status::fromDatabase($row, $languageRs);
|
||||||
|
|
||||||
|
$this->close();
|
||||||
|
|
||||||
|
return $status;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -92,6 +92,8 @@ class TicketGateway extends CommonDao {
|
|||||||
function createTicket($ticket, $heskSettings) {
|
function createTicket($ticket, $heskSettings) {
|
||||||
global $hesklang;
|
global $hesklang;
|
||||||
|
|
||||||
|
$this->init();
|
||||||
|
|
||||||
$dueDate = $ticket->dueDate ? "'{$ticket->dueDate}'" : "NULL";
|
$dueDate = $ticket->dueDate ? "'{$ticket->dueDate}'" : "NULL";
|
||||||
// Prepare SQL for custom fields
|
// Prepare SQL for custom fields
|
||||||
$customWhere = '';
|
$customWhere = '';
|
||||||
@ -103,17 +105,17 @@ class TicketGateway extends CommonDao {
|
|||||||
$customWhat .= ", '" . (isset($ticket->customFields[$i]) ? hesk_dbEscape($ticket->customFields[$i]) : '') . "'";
|
$customWhat .= ", '" . (isset($ticket->customFields[$i]) ? hesk_dbEscape($ticket->customFields[$i]) : '') . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$suggestedArticles = '';
|
$suggestedArticles = 'NULL';
|
||||||
if ($ticket->suggestedArticles !== null && !empty($ticket->suggestedArticles)) {
|
if ($ticket->suggestedArticles !== null && !empty($ticket->suggestedArticles)) {
|
||||||
$suggestedArticles = implode(',', $ticket->suggestedArticles);
|
$suggestedArticles = "'" .implode(',', $ticket->suggestedArticles) . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$latitude = $ticket->location !== null
|
$latitude = $ticket->location !== null
|
||||||
&& isset($ticket->location[0])
|
&& isset($ticket->location[0])
|
||||||
&& $ticket->location[0] !== null ? $ticket->location[0] : '';
|
&& $ticket->location[0] !== null ? $ticket->location[0] : 'E-0';
|
||||||
$longitude = $ticket->location !== null
|
$longitude = $ticket->location !== null
|
||||||
&& isset($ticket->location[1])
|
&& isset($ticket->location[1])
|
||||||
&& $ticket->location[1] !== null ? $ticket->location[1] : '';
|
&& $ticket->location[1] !== null ? $ticket->location[1] : 'E-0';
|
||||||
$userAgent = $ticket->userAgent !== null ? $ticket->userAgent : '';
|
$userAgent = $ticket->userAgent !== null ? $ticket->userAgent : '';
|
||||||
$screenResolutionWidth = $ticket->screenResolution !== null
|
$screenResolutionWidth = $ticket->screenResolution !== null
|
||||||
&& isset($ticket->screenResolution[0])
|
&& isset($ticket->screenResolution[0])
|
||||||
@ -165,8 +167,8 @@ class TicketGateway extends CommonDao {
|
|||||||
'" . hesk_dbEscape($ticket->message) . "',
|
'" . hesk_dbEscape($ticket->message) . "',
|
||||||
NOW(),
|
NOW(),
|
||||||
NOW(),
|
NOW(),
|
||||||
'" . $suggestedArticles . "',
|
" . $suggestedArticles . ",
|
||||||
'" . hesk_dbEscape($ticket->ipAddress) . "',
|
'" . hesk_dbEscape($ipAddress) . "',
|
||||||
'" . hesk_dbEscape($ticket->language) . "',
|
'" . hesk_dbEscape($ticket->language) . "',
|
||||||
'" . intval($ticket->openedBy) . "',
|
'" . intval($ticket->openedBy) . "',
|
||||||
'" . intval($ticket->ownerId) . "',
|
'" . intval($ticket->ownerId) . "',
|
||||||
@ -186,14 +188,18 @@ class TicketGateway extends CommonDao {
|
|||||||
";
|
";
|
||||||
|
|
||||||
hesk_dbQuery($sql);
|
hesk_dbQuery($sql);
|
||||||
|
$id = hesk_dbInsertID();
|
||||||
|
|
||||||
$rs = hesk_dbQuery('SELECT `dt`, `lastchange` FROM `' . hesk_dbEscape($heskSettings['db_pfix']) . 'tickets` WHERE `id` = ' . intval(hesk_dbInsertID()));
|
$rs = hesk_dbQuery('SELECT `dt`, `lastchange` FROM `' . hesk_dbEscape($heskSettings['db_pfix']) . 'tickets` WHERE `id` = ' . intval($id));
|
||||||
$row = hesk_dbFetchAssoc($rs);
|
$row = hesk_dbFetchAssoc($rs);
|
||||||
|
|
||||||
$generatedFields = new TicketGatewayGeneratedFields();
|
$generatedFields = new TicketGatewayGeneratedFields();
|
||||||
|
$generatedFields->id = $id;
|
||||||
$generatedFields->dateCreated = $row['dt'];
|
$generatedFields->dateCreated = $row['dt'];
|
||||||
$generatedFields->dateModified = $row['lastchange'];
|
$generatedFields->dateModified = $row['lastchange'];
|
||||||
|
|
||||||
|
$this->close();
|
||||||
|
|
||||||
return $generatedFields;
|
return $generatedFields;
|
||||||
}
|
}
|
||||||
}
|
}
|
@ -10,6 +10,8 @@ namespace BusinessLogic\Tickets\TicketCreatorTests;
|
|||||||
|
|
||||||
|
|
||||||
use BusinessLogic\Security\UserContext;
|
use BusinessLogic\Security\UserContext;
|
||||||
|
use BusinessLogic\Statuses\DefaultStatusForAction;
|
||||||
|
use BusinessLogic\Statuses\Status;
|
||||||
use BusinessLogic\Tickets\Autoassigner;
|
use BusinessLogic\Tickets\Autoassigner;
|
||||||
use BusinessLogic\Tickets\CreateTicketByCustomerModel;
|
use BusinessLogic\Tickets\CreateTicketByCustomerModel;
|
||||||
use BusinessLogic\Tickets\NewTicketValidator;
|
use BusinessLogic\Tickets\NewTicketValidator;
|
||||||
@ -18,6 +20,7 @@ use BusinessLogic\Tickets\TicketGatewayGeneratedFields;
|
|||||||
use BusinessLogic\Tickets\TrackingIdGenerator;
|
use BusinessLogic\Tickets\TrackingIdGenerator;
|
||||||
use BusinessLogic\ValidationModel;
|
use BusinessLogic\ValidationModel;
|
||||||
use Core\Constants\Priority;
|
use Core\Constants\Priority;
|
||||||
|
use DataAccess\Statuses\StatusGateway;
|
||||||
use DataAccess\Tickets\TicketGateway;
|
use DataAccess\Tickets\TicketGateway;
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
@ -43,6 +46,11 @@ class CreateTicketTest extends TestCase {
|
|||||||
*/
|
*/
|
||||||
private $autoassigner;
|
private $autoassigner;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @var $statusGateway \PHPUnit_Framework_MockObject_MockObject
|
||||||
|
*/
|
||||||
|
private $statusGateway;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var $ticketRequest CreateTicketByCustomerModel
|
* @var $ticketRequest CreateTicketByCustomerModel
|
||||||
*/
|
*/
|
||||||
@ -78,8 +86,10 @@ class CreateTicketTest extends TestCase {
|
|||||||
$this->newTicketValidator = $this->createMock(NewTicketValidator::class);
|
$this->newTicketValidator = $this->createMock(NewTicketValidator::class);
|
||||||
$this->trackingIdGenerator = $this->createMock(TrackingIdGenerator::class);
|
$this->trackingIdGenerator = $this->createMock(TrackingIdGenerator::class);
|
||||||
$this->autoassigner = $this->createMock(Autoassigner::class);
|
$this->autoassigner = $this->createMock(Autoassigner::class);
|
||||||
|
$this->statusGateway = $this->createMock(StatusGateway::class);
|
||||||
|
|
||||||
$this->ticketCreator = new TicketCreator($this->newTicketValidator, $this->trackingIdGenerator, $this->autoassigner, $this->ticketGateway);
|
$this->ticketCreator = new TicketCreator($this->newTicketValidator, $this->trackingIdGenerator,
|
||||||
|
$this->autoassigner, $this->statusGateway, $this->ticketGateway);
|
||||||
|
|
||||||
$this->ticketRequest = new CreateTicketByCustomerModel();
|
$this->ticketRequest = new CreateTicketByCustomerModel();
|
||||||
$this->ticketRequest->name = 'Name';
|
$this->ticketRequest->name = 'Name';
|
||||||
@ -105,6 +115,11 @@ class CreateTicketTest extends TestCase {
|
|||||||
$this->autoassigner->method('getNextUserForTicket')->willReturn(1);
|
$this->autoassigner->method('getNextUserForTicket')->willReturn(1);
|
||||||
$this->ticketGatewayGeneratedFields = new TicketGatewayGeneratedFields();
|
$this->ticketGatewayGeneratedFields = new TicketGatewayGeneratedFields();
|
||||||
$this->ticketGateway->method('createTicket')->willReturn($this->ticketGatewayGeneratedFields);
|
$this->ticketGateway->method('createTicket')->willReturn($this->ticketGatewayGeneratedFields);
|
||||||
|
|
||||||
|
$status = new Status();
|
||||||
|
$status->id = 1;
|
||||||
|
$this->statusGateway->method('getStatusForDefaultAction')
|
||||||
|
->willReturn($status);
|
||||||
}
|
}
|
||||||
|
|
||||||
function testItSavesTheTicketToTheDatabase() {
|
function testItSavesTheTicketToTheDatabase() {
|
||||||
@ -185,7 +200,7 @@ class CreateTicketTest extends TestCase {
|
|||||||
//-- Arrange
|
//-- Arrange
|
||||||
$this->ticketGatewayGeneratedFields->dateCreated = 'date created';
|
$this->ticketGatewayGeneratedFields->dateCreated = 'date created';
|
||||||
$this->ticketGatewayGeneratedFields->dateModified = 'date modified';
|
$this->ticketGatewayGeneratedFields->dateModified = 'date modified';
|
||||||
|
$this->ticketGatewayGeneratedFields->id = 50;
|
||||||
|
|
||||||
//-- Act
|
//-- Act
|
||||||
$ticket = $this->ticketCreator->createTicketByCustomer($this->ticketRequest, $this->heskSettings, $this->modsForHeskSettings, $this->userContext);
|
$ticket = $this->ticketCreator->createTicketByCustomer($this->ticketRequest, $this->heskSettings, $this->modsForHeskSettings, $this->userContext);
|
||||||
@ -193,5 +208,28 @@ class CreateTicketTest extends TestCase {
|
|||||||
//-- Assert
|
//-- Assert
|
||||||
self::assertThat($ticket->dateCreated, self::equalTo($this->ticketGatewayGeneratedFields->dateCreated));
|
self::assertThat($ticket->dateCreated, self::equalTo($this->ticketGatewayGeneratedFields->dateCreated));
|
||||||
self::assertThat($ticket->lastChanged, self::equalTo($this->ticketGatewayGeneratedFields->dateModified));
|
self::assertThat($ticket->lastChanged, self::equalTo($this->ticketGatewayGeneratedFields->dateModified));
|
||||||
|
self::assertThat($ticket->id, self::equalTo($this->ticketGatewayGeneratedFields->id));
|
||||||
|
}
|
||||||
|
|
||||||
|
function testItSetsTheDefaultStatus() {
|
||||||
|
//-- Act
|
||||||
|
$ticket = $this->ticketCreator->createTicketByCustomer($this->ticketRequest, $this->heskSettings, $this->modsForHeskSettings, $this->userContext);
|
||||||
|
|
||||||
|
//-- Assert
|
||||||
|
self::assertThat($ticket->statusId, self::equalTo(1));
|
||||||
|
}
|
||||||
|
|
||||||
|
function testItSetsTheDefaultProperties() {
|
||||||
|
//-- Act
|
||||||
|
$ticket = $this->ticketCreator->createTicketByCustomer($this->ticketRequest, $this->heskSettings, $this->modsForHeskSettings, $this->userContext);
|
||||||
|
|
||||||
|
//-- Assert
|
||||||
|
self::assertThat($ticket->archived, self::isFalse());
|
||||||
|
self::assertThat($ticket->locked, self::isFalse());
|
||||||
|
self::assertThat($ticket->openedBy, self::equalTo(0));
|
||||||
|
self::assertThat($ticket->numberOfReplies, self::equalTo(0));
|
||||||
|
self::assertThat($ticket->numberOfStaffReplies, self::equalTo(0));
|
||||||
|
self::assertThat($ticket->timeWorked, self::equalTo('00:00:00'));
|
||||||
|
self::assertThat($ticket->lastReplier, self::equalTo(0));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user