createCustomField example

/** * @param array<int, mixed>|null $existedData * @param array<int, mixed>|null $updateData * @param array<int, mixed>|null $expectData * * @dataProvider createDataProvider */
    public function testCreateCustomFieldForCustomerGroup(string $option, ?array $existedData, ?array $updateData, ?array $expectData): void
    {
        $customFieldName = 'custom_field_test';
        $entity = 'customer_group';
        $customFieldId = $this->createCustomField($customFieldName$entity);

        $email = 'thuy@gmail.com';
        $this->prepareCustomer($email[
            'requestedGroup' => [
                'id' => $this->ids->create('customer_group'),
                'name' => 'foo',
                'customFields' => [$customFieldName => $existedData],
            ],
        ]);

        $sequenceId = Uuid::randomHex();
        

        $mapping[] = [
            'key' => 'translations.DEFAULT.customFields.custom_field_5',
            'mappedKey' => 'custom_field_5',
        ];
        $mapping[] = [
            'key' => 'translations.DEFAULT.customFields',
            'mappedKey' => 'custom_fields',
        ];
        $this->updateProfileMapping($profile->getId()$mapping);

        $this->createCustomField([
            [
                'name' => 'custom_field_1',
                'type' => 'string',
            ],
            [
                'name' => 'custom_field_2',
                'type' => 'int',
            ],
            [
                'name' => 'custom_field_3',
                'type' => 'bool',
            ],
/** * @param array<int, mixed>|null $existedData * @param array<int, mixed>|null $updateData * @param array<int, mixed>|null $expectData * * @dataProvider createDataProvider */
    public function testCreateCustomFieldForOrder(string $option, ?array $existedData, ?array $updateData, ?array $expectData): void
    {
        $customFieldName = 'custom_field_test';
        $entity = 'order';
        $customFieldId = $this->createCustomField($customFieldName$entity);

        $this->createCustomerAndLogin();
        $this->createOrder($this->ids->get('customer')['customFields' => [$customFieldName => $existedData]]);

        $sequenceId = Uuid::randomHex();
        $this->flowRepository->create([[
            'name' => 'Cancel order',
            'eventName' => 'state_enter.order.state.cancelled',
            'priority' => 1,
            'active' => true,
            'sequences' => [
                [
/** * @param array<int, mixed>|null $existedData * @param array<int, mixed>|null $updateData * @param array<int, mixed>|null $expectData * * @dataProvider createDataProvider */
    public function testCreateCustomFieldForCustomer(string $option, ?array $existedData, ?array $updateData, ?array $expectData): void
    {
        $customFieldName = 'custom_field_test';
        $entity = 'customer';
        $customFieldId = $this->createCustomField($customFieldName$entity);

        $email = 'thuy@gmail.com';
        $this->prepareCustomer($email['customFields' => [$customFieldName => $existedData]]);

        $sequenceId = Uuid::randomHex();
        $this->flowRepository->create([[
            'name' => 'Customer login',
            'eventName' => CustomerLoginEvent::EVENT_NAME,
            'priority' => 1,
            'active' => true,
            'sequences' => [
                [

    public function testProductFeaturesContainCorrectInformation(array $testedFeature, array $productData, array $expectedFeature): void
    {
        $this->createLanguage(self::TEST_LANGUAGE_ID);

        if ($testedFeature['type'] === ProductFeatureSetDefinition::TYPE_PRODUCT_CUSTOM_FIELD) {
            $this->createCustomField([]);
        }

        $this->createProduct([...[
            'featureSet' => $this->createFeatureSet([$testedFeature]),
        ], ...$productData]);

        $cart = $this->getProductCart();
        $lineItem = $cart->get($this->ids->get('product'));

        static::assertInstanceOf(LineItem::class$lineItem);
        $features = $lineItem->getPayload()['features'];
        
Home | Imprint | This part of the site doesn't use cookies.