$order->id = 98765), 0.5, [ 'product_code' => 'V01PAK', 'shipping_address' => [ 'firstname' => 'Max', 'lastname' => 'Mustermann', 'company' => '', 'address' => 'Hauptstrasse', 'houseNumber' => '5', 'zipcode' => '10115', 'city' => 'Berlin', 'country' => (object) ['code' => 'DE'], 'email' => 'max@example.com', 'phone' => '+4930123456', 'postnumber' => null, ], ], [ 'default_product' => 'V01PAK', 'label_format' => 'PDF', 'dimensions' => [ 'V01PAK' => ['length' => 30, 'width' => 20, 'height' => 10], 'default' => ['length' => 30, 'width' => 20, 'height' => 10], ], 'sender' => [ 'company' => 'mivita care gmbh', 'name' => '', 'street' => 'Waldstr.', 'houseNumber' => '3e', 'postalCode' => '86498', 'city' => 'Kettershausen', 'country' => 'DE', 'email' => 'versand@example.com', 'phone' => '+4987654321', ], ] ); expect($orderData['weight_kg'])->toBe(0.5); }); it('allows manually entered weights below the calculated order weight within DHL limits', function () { (new DhlShipmentWeightCalculator)->assertWithinProductLimit(0.5, 'V01PAK'); expect(true)->toBeTrue(); }); it('passes the manually entered weight to the shipment creation job', function () { Bus::fake(); $reflection = new ReflectionClass(SettingController::class); $property = $reflection->getProperty('cachedDhlConfig'); $property->setAccessible(true); $property->setValue(null, [ 'use_queue' => true, 'print_only_if_codeable' => false, 'base_url' => 'https://api-eu.dhl.com', 'default_product' => 'V01PAK', 'label_format' => 'PDF', 'dimensions' => [ 'V01PAK' => ['length' => 30, 'width' => 20, 'height' => 10], 'default' => ['length' => 30, 'width' => 20, 'height' => 10], ], 'sender' => [ 'company' => 'mivita care gmbh', 'street' => 'Waldstr.', 'houseNumber' => '3e', 'postalCode' => '86498', 'city' => 'Kettershausen', 'country' => 'DE', ], ]); $order = new ShoppingOrder; $order->id = 12345; $order->weight = 2500; $order->exists = true; $service = new DhlShipmentService; $result = $service->createShipment($order, 0.5, [ 'shipping_address' => [ 'country' => (object) ['code' => 'AT'], ], ]); expect($result['success'])->toBeTrue() ->and($result['queued'])->toBeTrue(); Bus::assertDispatched(CreateShipmentJob::class, function (CreateShipmentJob $job) { return $job->weight === 0.5; }); });