Esempio n. 1
0
 /**
  * @covers sAdmin::sGetPremiumDispatches
  */
 public function testsGetPremiumDispatches()
 {
     // No basket, return empty array,
     $this->assertEquals(array(), $this->module->sGetPremiumDispatches());
     $this->module->sSYSTEM->sSESSION_ID = uniqid();
     $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID);
     $this->basketModule->sAddArticle('SW10118.8');
     $result = $this->module->sGetPremiumDispatches();
     $this->assertGreaterThan(0, count($result));
     foreach ($result as $dispatch) {
         $this->assertArrayHasKey('id', $dispatch);
         $this->assertArrayHasKey('name', $dispatch);
         $this->assertArrayHasKey('description', $dispatch);
         $this->assertArrayHasKey('calculation', $dispatch);
         $this->assertArrayHasKey('status_link', $dispatch);
     }
 }
Esempio n. 2
0
 /**
  * Get selected dispatch or select a default dispatch
  *
  * @return boolean|array
  */
 public function getSelectedDispatch()
 {
     if (empty($this->session['sCountry'])) {
         return false;
     }
     $dispatches = $this->admin->sGetPremiumDispatches($this->session['sCountry'], null, $this->session['sState']);
     if (empty($dispatches)) {
         unset($this->session['sDispatch']);
         return false;
     }
     foreach ($dispatches as $dispatch) {
         if ($dispatch['id'] == $this->session['sDispatch']) {
             return $dispatch;
         }
     }
     $dispatch = reset($dispatches);
     $this->session['sDispatch'] = (int) $dispatch['id'];
     return $dispatch;
 }