'')->name('modal_load'); app('router')->getRoutes()->refreshNameLookups(); }); function dhlShippingButtonProbe(): Controller { return new class extends Controller { public function render(ShoppingOrder $order): string { return $this->getDhlShippingButton($order); } }; } it('renders no shipping button when the order has no DHL shipment', function () { $order = new ShoppingOrder; $order->id = 5; $order->setRelation('dhlShipments', collect()); expect(dhlShippingButtonProbe()->render($order))->toBe(''); }); it('renders the shipping-fast button when the order has a DHL shipment', function () { $order = new ShoppingOrder; $order->id = 42; $order->setRelation('dhlShipments', collect([new DhlShipment])); $html = dhlShippingButtonProbe()->render($order); expect($html) ->toContain('fa-shipping-fast') ->toContain('data-action="user-order-dhl-info"') ->toContain('data-id="42"'); });