public function testGetByTicketId()
 {
     $id = 1;
     $uniqueId = 'unique_id';
     $ticketSequenceNumber = 123;
     $branch = new Branch('DB', 'Dummy Branch', 'Description');
     $ticket = new Ticket(new UniqueId($uniqueId), new TicketSequenceNumber($ticketSequenceNumber), 'Subject', 'Description', $branch, new User(1, User::TYPE_DIAMANTE), new OroUser(), new Source(Source::WEB), new Priority(Priority::PRIORITY_MEDIUM), new Status(Status::NEW_ONE));
     $this->em->expects($this->once())->method('find')->with($this->equalTo(self::CLASS_NAME), $this->equalTo($id))->will($this->returnValue($ticket));
     $result = $this->repository->get($id);
     $this->assertNotNull($result);
     $this->assertEquals($ticket, $result);
 }
 public function testGetByTicketId()
 {
     $id = 1;
     $uniqueId = 'unique_id';
     $ticketSequenceNumber = 123;
     $branch = new Branch('DB', 'Dummy Branch', 'Description');
     $ticket = new Ticket(new UniqueId($uniqueId), new TicketSequenceNumber($ticketSequenceNumber), 'Subject', 'Description', $branch, new User(1, User::TYPE_DIAMANTE), new OroUser(), new Source(Source::WEB), new Priority(Priority::PRIORITY_MEDIUM), new Status(Status::NEW_ONE));
     $this->em->expects($this->once())->method('createQueryBuilder')->will($this->returnValue($this->queryBuilder));
     $this->queryBuilder->expects($this->once())->method('select')->with($this->equalTo('t'))->will($this->returnValue($this->queryBuilder));
     $this->queryBuilder->expects($this->once())->method('from')->will($this->returnValue($this->queryBuilder));
     $this->queryBuilder->expects($this->once())->method('where')->will($this->returnValue($this->queryBuilder));
     $this->queryBuilder->expects($this->once())->method('setParameter')->will($this->returnValue($this->queryBuilder));
     $this->queryBuilder->expects($this->once())->method('getQuery')->will($this->returnValue($this->searchQuery));
     $this->em->expects($this->atLeastOnce())->method('newHydrator')->with($this->equalTo(Query::HYDRATE_OBJECT))->will($this->returnValue($this->objectHydrator));
     $this->objectHydrator->expects($this->atLeastOnce())->method('hydrateAll')->will($this->returnValue($ticket));
     $result = $this->repository->get($id);
     $this->assertNotNull($result);
     $this->assertEquals($ticket, $result);
 }