public function testToArray() { $ticket = $this->_buildTicket(); // Add the channel we left off in the basic build $ticket->setChannel(new Channel('Support')); $ticket2 = Ticket::fromArray($ticket->toArray()); $this->assertEquals($ticket->toArray(), $ticket2->toArray()); }
public static function fromArray(array $data) { $ticket = new Ticket($data['id']); $participants = []; foreach ($data['timeline'] as $event) { $ticket->addEvent(TicketEvent::fromArray($event)); } return $ticket; }