You are here

function SupportTicketTestBase::supportTicketGetTicketByTitle in Support Ticketing System 8

Get a support ticket from the database based on its title.

Parameters

$title: A ticket title, usually generated by $this->randomMachineName().

$reset: (optional) Whether to reset the entity cache.

Return value

\Drupal\support_ticket\SupportTicketInterface A support_ticket entity matching $title.

4 calls to SupportTicketTestBase::supportTicketGetTicketByTitle()
SupportTicketCreationTest::testFailedTicketCreation in modules/support_ticket/src/Tests/SupportTicketCreationTest.php
Verifies that a transaction rolls back the failed creation.
SupportTicketCreationTest::testTicketCreation in modules/support_ticket/src/Tests/SupportTicketCreationTest.php
Creates a "ticket" support_ticket and verifies its consistency in the database.
SupportTicketSaveTest::testImport in modules/support_ticket/src/Tests/SupportTicketSaveTest.php
Checks whether custom support_ticket IDs are saved properly during an import operation.
SupportTicketSaveTest::testTimestamps in modules/support_ticket/src/Tests/SupportTicketSaveTest.php
Verifies accuracy of the "created" and "changed" timestamp functionality.

File

modules/support_ticket/src/Tests/SupportTicketTestBase.php, line 155
Contains \Drupal\support_ticket\Tests\SupportTicketTestBase.

Class

SupportTicketTestBase
Sets up ticket type.

Namespace

Drupal\support_ticket\Tests

Code

function supportTicketGetTicketByTitle($title, $reset = FALSE) {
  if ($reset) {
    \Drupal::entityManager()
      ->getStorage('support_ticket')
      ->resetCache();
  }
  $tickets = entity_load_multiple_by_properties('support_ticket', array(
    'title' => $title,
  ));

  // Load the first ticket returned from the database.
  $returned_ticket = reset($tickets);
  return $returned_ticket;
}