public function testPurge()
 {
     $gateway = $this->getTableGateway();
     $handler = new QueueSubscriber($gateway);
     $before = new DateTime('2015-04-01 14:29:00');
     $event = new QueuePurgeActivityEvent($before);
     $handler->onPurgeActivity($event);
     #assert the result
     $this->assertEquals(89, $event->getResult());
     # assert datasets match
     $resulting_table = $this->getConnection()->createQueryTable("later_job_transition", "SELECT * FROM later_job_transition ORDER BY dte_occured ASC");
     $expected_table = $this->createXmlDataSet(__DIR__ . DIRECTORY_SEPARATOR . 'Fixture' . DIRECTORY_SEPARATOR . "purgehistory_handler_result.xml")->getTable("later_job_transition");
     $this->assertTablesEqual($expected_table, $resulting_table);
 }
 public function testQueryWithJob()
 {
     $this->createApplication();
     $gateway = $this->getTableGateway();
     $handler = new QueueSubscriber($gateway);
     $job_id = '4f5bdee5-3812-34cc-8031-245dcec8787e';
     $event = new QueueQueryActivityEvent(0, 100, 'DESC', null, null, $job_id, null);
     $handler->onQueryActivity($event);
     $result = $event->getResult();
     $this->assertEquals(1, count($result));
     $expected = array(95);
     foreach ($result as $activity) {
         $this->assertContains($activity->getTransitionId(), $expected);
     }
 }