Exemplo n.º 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);
 }
Exemplo n.º 2
0
 public function setup()
 {
     parent::setUp();
     if (!self::$object) {
         self::$object = self::$DI['app']['acl']->get(self::$DI['user']);
     }
 }
 public function setUp()
 {
     parent::setUp();
     if (!self::$initialized) {
         $found = false;
         foreach (self::$DI['record_2']->get_databox()->get_meta_structure()->get_elements() as $field) {
             if (!$field->isBusiness()) {
                 continue;
             }
             $found = true;
         }
         if (!$found) {
             $field = \databox_field::create(self::$DI['app'], self::$DI['record_2']->get_databox(), 'testBusiness' . mt_rand(), false);
             $field->set_business(true);
             $field->save();
         }
         foreach (self::$DI['app']['phraseanet.appbox']->get_databoxes() as $databox) {
             break;
         }
     }
     $this->initialize();
     if (!self::$searchEngine instanceof SearchEngineInterface) {
         $this->markTestSkipped('Unable to initialize search Engine');
     }
     $options = new SearchEngineOptions();
     $options->onCollections($databox->get_collections());
     $this->options = $options;
 }
Exemplo n.º 4
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']['phraseanet.appbox']->get_databoxes();
     $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);
 }
Exemplo n.º 5
0
 public function setUp()
 {
     parent::setUp();
     self::$DI['app']->register(new \API_V1_Timer());
     self::$DI['app']['conf']->set(['main', 'api-timers'], true);
     $this->api = $this->getMock("API_V1_adapter", ["get_version"], [], "", false);
     $this->api->expects($this->any())->method("get_version")->will($this->returnValue("my_super_version1.0"));
 }
Exemplo n.º 6
0
 public function setUp()
 {
     parent::setUp();
     // Reset thumbtitle in order to have consistent tests (testGet_title)
     if (!self::$thumbtitled) {
         foreach ($this->getRecord1()->get_databox()->get_meta_structure() as $databox_field) {
             $databox_field->set_thumbtitle(false)->save();
         }
         self::$thumbtitled = true;
     }
 }
Exemplo n.º 7
0
 public function setUp()
 {
     parent::setUp();
     $sql = 'DELETE FROM bridge_apis WHERE name = "Apitest"';
     $stmt = self::$DI['app']['phraseanet.appbox']->get_connection()->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     $this->type = 'Apitest';
     $api = Bridge_Api::create(self::$DI['app'], $this->type);
     $this->id = $api->get_id();
     $this->object = new Bridge_Api(self::$DI['app'], $api->get_id());
 }
Exemplo n.º 8
0
 public function setUp()
 {
     parent::setUp();
     /**
      * Reset thumbtitle in order to have consistent tests (testGet_title)
      */
     if (!self::$thumbtitled) {
         foreach (self::$DI['record_1']->get_databox()->get_meta_structure() as $databox_field) {
             /* @var $databox_field \databox_field */
             $databox_field->set_thumbtitle(false)->save();
         }
         self::$thumbtitled = true;
     }
 }
Exemplo n.º 9
0
 public function setUp()
 {
     parent::setUp();
     try {
         $sql = 'DELETE FROM bridge_apis WHERE name = "Apitest"';
         $stmt = self::$DI['app']['phraseanet.appbox']->get_connection()->prepare($sql);
         $stmt->execute();
         $stmt->closeCursor();
         $this->api = Bridge_Api::create(self::$DI['app'], 'Apitest');
         $this->dist_id = 'EZ1565loPP';
         $this->named = 'Fête à pinpins';
         $this->account = Bridge_Account::create(self::$DI['app'], $this->api, self::$DI['user'], $this->dist_id, $this->named);
         $this->object = new Bridge_AccountSettings(self::$DI['app']['phraseanet.appbox'], $this->account);
     } catch (Exception $e) {
         $this->fail($e->getMessage());
     }
 }
Exemplo n.º 10
0
 public function setUp()
 {
     parent::setUp();
     $sql = 'DELETE FROM bridge_apis WHERE name = "Apitest"';
     $stmt = self::$DI['app']['phraseanet.appbox']->get_connection()->prepare($sql);
     $stmt->execute();
     $stmt->closeCursor();
     $this->api = Bridge_Api::create(self::$DI['app'], 'Apitest');
     $this->dist_id = 'EZ1565loPP';
     $this->named = 'Fête à pinpins';
     $this->account = Bridge_Account::create(self::$DI['app'], $this->api, self::$DI['user'], $this->dist_id, $this->named);
     $this->title = 'GOGACKO';
     $this->status = 'Processing';
     $element = Bridge_Element::create(self::$DI['app'], $this->account, self::$DI['record_1'], $this->title, $this->status, $this->account->get_api()->get_connector()->get_default_element_type());
     $this->id = $element->get_id();
     $this->object = new Bridge_Element(self::$DI['app'], $this->account, $this->id);
 }
Exemplo n.º 11
0
 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']['phraseanet.appbox']->get_databoxes();
     $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);
     }
 }
Exemplo n.º 12
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']);
     }
 }
Exemplo n.º 13
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']['phraseanet.appbox']->get_databoxes();
     $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);
     }
 }
 public function setUp()
 {
     parent::setUp();
     $this->StubbedACL = $this->getMockBuilder('\\ACL')->disableOriginalConstructor()->getMock();
 }
Exemplo n.º 15
0
 public function setUp()
 {
     parent::setUp();
     self::$DI['app']->register(new \API_V1_Timer());
     $this->object = new API_V1_adapter(self::$DI['app']);
 }