prepareCustomer example

use SalesChannelApiTestBehaviour;

    private KernelBrowser $browser;

    private TestDataCollection $ids;

    private ?EntityRepository $customerRepository = null;

    private function createCustomerAndLogin(): void
    {
        $email = Uuid::randomHex() . '@example.com';
        $this->prepareCustomer($email);

        $this->login($email, 'shopware');
    }

    /** * @param array<string, mixed> $additionalData */
    private function prepareCustomer(?string $email = null, array $additionalData = []): void
    {
        static::assertNotNull($this->customerRepository);

        

    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();
        $this->flowRepository->create([[
            'name' => 'Customer group registration accepted',
            'eventName' => CustomerGroupRegistrationAccepted::EVENT_NAME,
            

    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' => [
                [
                    'id' => $sequenceId,
                    'parentId' => null,
                    
/** * @param array<string, mixed> $existedData * @param array<string, mixed> $updateData * @param array<string, mixed> $expectData * * @dataProvider createDataProvider */
    public function testAddAffiliateAndCampaignCodeForCustomer(array $existedData, array $updateData, array $expectData): void
    {
        $email = 'thuy@gmail.com';
        $this->prepareCustomer($email$existedData);

        $sequenceId = Uuid::randomHex();
        $this->flowRepository->create([[
            'name' => 'Customer login',
            'eventName' => CustomerLoginEvent::EVENT_NAME,
            'priority' => 1,
            'active' => true,
            'sequences' => [
                [
                    'id' => $sequenceId,
                    'parentId' => null,
                    
Home | Imprint | This part of the site doesn't use cookies.