setShippingAvailable example

return $repository;
    }

    private function getCountryStub(?string $id = null, ?bool $active = true, ?bool $shippingAvailable = true): CountryEntity
    {
        $country = new CountryEntity();

        $country->setId($id ?? Uuid::randomHex());
        $country->setActive((bool) $active);
        $country->addTranslated('name', 'test');
        $country->setShippingAvailable((bool) $shippingAvailable);

        return $country;
    }

    private function getContextMock(?ShippingLocation $shippingLocation = null): MockObject&SalesChannelContext
    {
        $context = $this->createMock(SalesChannelContext::class);

        $context->method('getShippingLocation')
            ->willReturn($shippingLocation);
        $context->method('getSalesChannelId')
            


    public function testValidateShippingAddressWithMixedItems(): void
    {
        $cart = new Cart('test');
        $cart->add((new LineItem('a', 'test'))->setStates([State::IS_DOWNLOAD]));
        $context = $this->createMock(SalesChannelContext::class);

        $country = new CountryEntity();
        $country->setId(Uuid::randomHex());
        $country->setActive(true);
        $country->setShippingAvailable(false);

        $idSearchResult = new IdSearchResult(
            1,
            [['data' => $country->getId(), 'primaryKey' => $country->getId()]],
            new Criteria(),
            Context::createDefaultContext()
        );
        $this->repository->method('searchIds')->willReturn($idSearchResult);

        $shippingLocation = new ShippingLocation($country, null, null);
        $context->method('getShippingLocation')->willReturn($shippingLocation);

        
Home | Imprint | This part of the site doesn't use cookies.