/** * Lists history records. * */ public function indexAction() { $queueOptions = $this->container->getParameter('jobqueue.adapter.options'); $uiOptions = $this->container->getParameter('jobqueue.ui.options'); $historyAdapterClass = $queueOptions['history_adapter_class']; $historyAdapter = new $historyAdapterClass($this->container->getParameter('jobqueue.adapter.options'), $this->container->get('doctrine')->getEntityManager()); $query = array(); $pageParam = 'hpage'; $query['page'] = $this->getRequest()->query->get($pageParam) ?: 1; $query['reverse'] = $this->getRequest()->query->get('reverse') ?: null; $query['job'] = $this->getRequest()->query->get('job') ?: null; $offset = ($uiOptions['pagination']['limit'] * $query['page']) - $uiOptions['pagination']['limit']; $history = new History($historyAdapter, $uiOptions['pagination']['limit'], $offset, $query['reverse'], $query['job']); $pagination = $this->getPagination($query, $uiOptions['pagination'], $history->getTotal(), $pageParam); return $this->render('NineThousandJobqueueBundle:History:index.html.twig', array( 'history' => $history, 'pagination' => $pagination, )); }
/** * @dataProvider historyProvider * @covers NineThousand\Bundle\NineThousandJobqueueBundle\Model\History\StandardHistory::factory */ public function testFactory($history1, $history2, $history3, $history4) { $em = $this->container->get('doctrine')->getEntityManager(); $testHistory = array($history1, $history2, $history3, $history4); $fixtures = new LoadStandardHistoryTestData(self::$kernel); $fixtures->setData($testHistory); $this->data = $fixtures->load($em); $queueOptions = $this->container->getParameter('jobqueue.adapter.options'); $historyAdapterClass = $queueOptions['history_adapter_class']; $historyAdapter = new $historyAdapterClass($this->container->getParameter('jobqueue.adapter.options'), $this->container->get('doctrine')->getEntityManager()); $this->history = StandardHistory::factory($historyAdapter); $this->assertTrue(($this->history->count() >= 4), ""); }