'DE', 'phone' => '49', 'en' => 'Germany', 'de' => 'Deutschland', 'es' => 'Alemania', 'fr' => 'Allemagne', 'it' => 'Germania', 'ru' => 'Германия', ]); $shipping = Shipping::create(['name' => 'Standard', 'active' => true]); ShippingPrice::create([ 'shipping_id' => $shipping->id, 'price' => 19.90, 'price_comp' => 19.90, 'num_comp' => 0, 'tax_rate' => 19, 'weight_from' => 1, 'weight_to' => 31500, ]); return ShippingCountry::create(['shipping_id' => $shipping->id, 'country_id' => $country->id]); } describe('Yard Versandkosten-Steuer', function () { beforeEach(function () { $this->shippingCountry = makeShippingEnvForYardTaxTest(); }); it('berechnet den Netto-Versand und den Steueranteil (brutto minus netto)', function () { $yard = Yard::instance('test-shipping-tax'); $yard->destroy(); $yard->setShippingCountryWithPrice($this->shippingCountry->id); $yard->add(1, 'A', 1, 10.0, false, false, ['weight' => 500]); $yard->reCalculateShippingPrice(); expect((float) $yard->getShippingPrice())->toBe(19.90) ->and($yard->shippingNet(2, '.', ''))->toBe('16.72') ->and((float) $yard->getYardExtra('shipping_tax'))->toBe(3.18); $yard->destroy(); }); it('setzt den Steueranteil bei kostenlosem Versand auf 0', function () { $yard = Yard::instance('test-shipping-tax'); $yard->destroy(); $yard->setShippingCountryWithPrice($this->shippingCountry->id); $yard->reCalculateShippingPrice(); expect((float) $yard->getShippingPrice())->toBe(0.0) ->and((float) $yard->getYardExtra('shipping_tax'))->toBe(0.0); $yard->destroy(); }); });