setCountryStateId example

$countryState->setName('country-state-name');

        $address = new OrderAddressEntity();
        $address->setId('order-address-id');
        $address->setSalutationId('order-address-salutation-id');
        $address->setFirstName('order-address-first-name');
        $address->setLastName('order-address-last-name');
        $address->setStreet('order-address-street');
        $address->setZipcode('order-address-zipcode');
        $address->setCity('order-address-city');
        $address->setCountryId('order-address-country-id');
        $address->setCountryStateId('order-address-country-state-id');
        $address->setCountry($country);
        $address->setCountryState($countryState);

        return $address;
    }

    private function getDeliveryCollection(bool $withoutAddress = false): DeliveryCollection
    {
        $country = new CountryEntity();
        $country->setId('country-id');
        $country->setName('country-name');

        
static::assertEquals([new NotBlank()new ArrayOfUuid()]$constraints['stateIds']);
    }

    /** * @dataProvider getMatchValues */
    public function testRuleMatching(string $operator, bool $isMatching, string $stateId): void
    {
        $countryIds = ['kyln123', 'kyln456'];
        $salesChannelContext = $this->createMock(SalesChannelContext::class);
        $customerAddress = new CustomerAddressEntity();
        $customerAddress->setCountryStateId($stateId);
        $customer = new CustomerEntity();

        $customer->setActiveBillingAddress($customerAddress);
        $salesChannelContext->method('getCustomer')->willReturn($customer);
        $scope = new CheckoutRuleScope($salesChannelContext);
        $this->rule->assign(['stateIds' => $countryIds, 'operator' => $operator]);

        $match = $this->rule->match($scope);
        if ($isMatching) {
            static::assertTrue($match);
        } else {
            
Home | Imprint | This part of the site doesn't use cookies.