Example #1
0
 public function setUp()
 {
     parent::setUp();
     $report = $this->getMock('module_report', [], [], '', false);
     $report->expects($this->any())->method('getSbasId')->will($this->returnValue(self::$DI['collection']->get_databox()->get_sbas_id()));
     $this->sql = new module_report_sql(self::$DI['app'], $report);
 }
Example #2
0
 public function setUp()
 {
     parent::setUp();
     $date = new Datetime();
     $dmax = $date->format("Y-m-d H:i:s");
     $date->modify('-6 month');
     $dmin = $date->format("Y-m-d H:i:s");
     $databoxes = self::$DI['app']->getDataboxes();
     $ret = [];
     foreach ($databoxes as $databox) {
         $colls = $databox->get_collections();
         $rett = [];
         foreach ($colls as $coll) {
             $rett[$coll->get_coll_id()] = $coll->get_coll_id();
         }
         $ret[$databox->get_sbas_id()] = implode(',', $rett);
     }
     foreach ($ret as $sbasid => $collections) {
         $report = new module_report_connexion(self::$DI['app'], $dmin, $dmax, $sbasid, $collections);
         if (!$this->report instanceof module_report) {
             $this->report = $report;
         } elseif ($report->getTotal() > $this->report->getTotal()) {
             $this->report = $report;
         }
     }
     $this->report->setFilter([['f' => 'user', 'o' => '=', 'v' => 'admin'], ['f' => 'ddate', 'o' => 'LIKE', 'v' => '*'], ['f' => '1', 'o' => 'OR', 'v' => '1']]);
     $this->report->setUser_id(self::$DI['user']->getId());
     $this->report->setOrder('user', 'ASC');
     $this->filter = new module_report_sqlfilter(self::$DI['app'], $this->report);
 }
 public function setUp()
 {
     parent::setUp();
     $date = new Datetime();
     $this->dmax = $date->format("Y-m-d H:i:s");
     $date->modify('-6 month');
     $this->dmin = $date->format("Y-m-d H:i:s");
     $databoxes = self::$DI['app']->getDataboxes();
     $this->ret = [];
     foreach ($databoxes as $databox) {
         $colls = $databox->get_collections();
         $rett = [];
         foreach ($colls as $coll) {
             $rett[$coll->get_coll_id()] = $coll->get_coll_id();
         }
         $this->ret[$databox->get_sbas_id()] = implode(',', $rett);
     }
 }
Example #4
0
 public function setUp()
 {
     parent::setUp();
     $this->dashboard = new module_report_dashboard(self::$DI['app'], self::$DI['user']);
     $this->dashboard->setDate('-2 month', 'now');
     $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $this->dashboard->legendDay);
     $this->assertNotNull($this->dashboard->dmin);
     $this->assertNotNull($this->dashboard->dmax);
     $this->assertGreaterThanOrEqual(1, count($this->dashboard->authorizedCollection));
     $this->assertEquals($this->dashboard->authorizedCollection, $this->dashboard->authorizedCollection());
     foreach ($this->dashboard->authorizedCollection as $coll) {
         $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_ARRAY, $coll);
         $this->assertArrayHasKey('sbas_id', $coll);
         $this->assertArrayHasKey('coll', $coll);
         $this->assertArrayHasKey('name', $coll);
         $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_INT, $coll['sbas_id']);
         $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $coll['name']);
         $this->assertInternalType(PHPUnit_Framework_Constraint_IsType::TYPE_STRING, $coll['coll']);
     }
 }
Example #5
0
 public function setUp()
 {
     parent::setUp();
     $this->xml = '<?xml version="1.0" encoding="UTF-8"?>
     <record record_id="299">
       <description>
         <report ok="1">hello</report>
       </description>
      </record>';
     $date = new Datetime();
     $this->dmax = $date->format("Y-m-d H:i:s");
     $date->modify('-6 month');
     $this->dmin = $date->format("Y-m-d H:i:s");
     $databoxes = self::$DI['app']->getDataboxes();
     $this->ret = [];
     foreach ($databoxes as $databox) {
         $colls = $databox->get_collections();
         $rett = [];
         foreach ($colls as $coll) {
             $rett[$coll->get_coll_id()] = $coll->get_coll_id();
         }
         $this->ret[$databox->get_sbas_id()] = implode(',', $rett);
     }
 }