示例#1
0
 /**
  * @covers sAdmin::sGetPremiumShippingcosts
  */
 public function testsGetPremiumShippingcosts()
 {
     // No basket, return false,
     $this->assertFalse($this->module->sGetPremiumShippingcosts());
     $countries = $this->module->sGetCountryList();
     foreach ($countries as $country) {
         if ($country['countryiso']) {
             $germany = $country;
             break;
         }
     }
     $this->module->sSYSTEM->sSESSION_ID = uniqid();
     $this->session->offsetSet('sessionId', $this->module->sSYSTEM->sSESSION_ID);
     $this->basketModule->sAddArticle('SW10010');
     // With country data, no dispatch method
     $this->assertEquals(array('brutto' => 0, 'netto' => 0), $this->module->sGetPremiumShippingcosts($germany));
     // With dispatch method
     $this->session->offsetSet('sDispatch', 9);
     $result = $this->module->sGetPremiumShippingcosts($germany);
     $this->assertArrayHasKey('brutto', $result);
     $this->assertArrayHasKey('netto', $result);
     $this->assertArrayHasKey('value', $result);
     $this->assertArrayHasKey('factor', $result);
     $this->assertArrayHasKey('surcharge', $result);
     $this->assertArrayHasKey('tax', $result);
 }
示例#2
0
 /**
  * Get shipping costs as an array (brutto / netto) depending on selected country / payment
  *
  * @return array
  */
 public function getShippingCosts()
 {
     $country = $this->getSelectedCountry();
     $payment = $this->getSelectedPayment();
     if (empty($country) || empty($payment)) {
         return array('brutto' => 0, 'netto' => 0);
     }
     $shippingcosts = $this->admin->sGetPremiumShippingcosts($country);
     return empty($shippingcosts) ? array('brutto' => 0, 'netto' => 0) : $shippingcosts;
 }