getEmail example


      'forms' => [
        'install_settings_form' => [
          'driver' => $driver,
          $driver => $connection_info['default'],
        ],
        'install_configure_form' => [
          'site_name' => 'Drupal',
          'site_mail' => 'simpletest@example.com',
          'account' => [
            'name' => $this->rootUser->name,
            'mail' => $this->rootUser->getEmail(),
            'pass' => [
              'pass1' => $this->rootUser->pass_raw ?? $this->rootUser->passRaw,
              'pass2' => $this->rootUser->pass_raw ?? $this->rootUser->passRaw,
            ],
          ],
          // \Drupal\Core\Render\Element\Checkboxes::valueCallback() requires           // NULL instead of FALSE values for programmatic form submissions to           // disable a checkbox.           'enable_update_status_module' => NULL,
          'enable_update_status_emails' => NULL,
        ],
      ],

        );
        $link = $router->assemble([
            'sViewport' => 'register',
            'action' => 'confirmValidation',
            'sConfirmation' => $hash,
        ]);

        // Should be compatible with the sREGISTERCONFIRMATION context         $context = [
            'sConfirmLink' => $link,
            'email' => $customer->getEmail(),
            'sMAIL' => $customer->getEmail(),
            'firstname' => $customer->getFirstname(),
            'lastname' => $customer->getLastname(),
            'salutation' => $customer->getSalutation(),
            'customer_type' => $customer->getCustomerType(),
            'additional' => [
                'customer_type' => $customer->getCustomerType(),
            ],
            'accountmode' => $customer->getAccountMode(),
        ];

        


    public function getSalesChannelId(): ?string
    {
        return $this->salesChannelContext->getSalesChannel()->getId();
    }

    public function getMailStruct(): MailRecipientStruct
    {
        if (!$this->mailRecipientStruct instanceof MailRecipientStruct) {
            $this->mailRecipientStruct = new MailRecipientStruct([
                $this->customer->getEmail() => $this->customer->getFirstName() . ' ' . $this->customer->getLastName(),
            ]);
        }

        return $this->mailRecipientStruct;
    }

    public static function getAvailableData(): EventDataCollection
    {
        return (new EventDataCollection())
            ->add('customer', new EntityType(CustomerDefinition::class));
    }
}
// Set preferred_langcode to 'zh-hant'.     $user = $this->createUser();
    $user->set('preferred_langcode', 'zh-hant')->save();
    $preferredLangcode = $user->getPreferredLangcode();
    $this->assertSame('zh-hant', $preferredLangcode);

    // Recovery email should respect user preferred langcode by default if     // langcode not set.     $this->config('system.site')->set('mail', 'test@example.com')->save();
    $params['account'] = $user;
    $default_email = \Drupal::service('plugin.manager.mail')->mail('user', 'password_reset', $user->getEmail()$preferredLangcode$params);
    $this->assertTrue($default_email['result']);

    // Assert for zh.     $this->assertMailString('subject', 'hant subject', 1);
    $this->assertMailString('body', 'hant body', 1);
    $this->assertMailString('body', 'zh/user/reset', 1);

    // Recovery email should be fr when langcode specified.     $french_email = \Drupal::service('plugin.manager.mail')->mail('user', 'password_reset', $user->getEmail(), 'fr', $params);
    $this->assertTrue($french_email['result']);

    

    // Make sure the reduce duplicates element from the ManyToOneHelper is not     // displayed.     $this->assertSession()->fieldNotExists('edit-reduce-duplicates');

    // Filter the users by name/email.     $this->drupalGet('admin/people', ['query' => ['user' => $user_a->getAccountName()]]);
    $result = $this->xpath('//table/tbody/tr');
    $this->assertCount(1, $result, 'Filter by username returned the right amount.');
    $this->assertEquals($user_a->getAccountName()$result[0]->find('xpath', '/td[2]/a')->getText(), 'Filter by username returned the right user.');

    $this->drupalGet('admin/people', ['query' => ['user' => $user_a->getEmail()]]);
    $result = $this->xpath('//table/tbody/tr');
    $this->assertCount(1, $result, 'Filter by username returned the right amount.');
    $this->assertEquals($user_a->getAccountName()$result[0]->find('xpath', '/td[2]/a')->getText(), 'Filter by username returned the right user.');

    // Filter the users by permission 'administer taxonomy'.     $this->drupalGet('admin/people', ['query' => ['permission' => 'administer taxonomy']]);

    // Check if the correct users show up.     $this->assertSession()->elementNotExists('xpath', static::getLinkSelectorForUser($user_a));
    $this->assertSession()->elementExists('xpath', static::getLinkSelectorForUser($user_b));
    $this->assertSession()->elementExists('xpath', static::getLinkSelectorForUser($user_c));

    
$nestedCriteria2 = new Criteria();
        $nestedCriteria2->addAssociation('addresses');

        $criteria = new Criteria([$orderId]);

        /** @var OrderEntity|null $order */
        $order = $this->orderRepository->search($criteria$defaultContext)->first();

        static::assertNotNull($order);
        static::assertNotNull($order->getOrderCustomer());
        static::assertEquals($orderId$order->get('id'));
        static::assertEquals('test@example.com', $order->getOrderCustomer()->getEmail());
    }

    /** * Regression from NEXT-19378 */
    public function testCreateOrderWithoutCalculatedTaxesThrows(): void
    {
        $orderId = Uuid::randomHex();
        $defaultContext = Context::createDefaultContext();
        $orderData = $this->getOrderData($orderId$defaultContext);
        $orderData = \json_decode(\json_encode($orderData, \JSON_THROW_ON_ERROR), true, 512, \JSON_THROW_ON_ERROR);

        
$this->repository
            ->expects(static::once())
            ->method('upsert')
            ->with([
                [
                    'productId' => $productId,
                    'customerId' => $customer->getId(),
                    'salesChannelId' => $salesChannel->getId(),
                    'languageId' => $context->getLanguageId(),
                    'externalUser' => $customer->getFirstName(),
                    'externalEmail' => $customer->getEmail(),
                    'title' => $data->get('title'),
                    'content' => $data->get('content'),
                    'points' => $data->get('points'),
                    'status' => false,
                    'id' => $data->get('id'),
                ],
            ]$context);

        $event = new ReviewFormEvent(
            $context,
            $salesChannel->getId(),
            


    public function getName(): string
    {
        return self::EVENT_NAME;
    }

    public function getMailStruct(): MailRecipientStruct
    {
        if (!$this->mailRecipientStruct instanceof MailRecipientStruct) {
            $this->mailRecipientStruct = new MailRecipientStruct([
                $this->customer->getEmail() => $this->customer->getFirstName() . ' ' . $this->customer->getLastName(),
            ]);
        }

        return $this->mailRecipientStruct;
    }

    public function getCustomer(): CustomerEntity
    {
        return $this->customer;
    }

    


    public function getCustomerId(): string
    {
        return $this->getCustomer()->getId();
    }

    public function getMailStruct(): MailRecipientStruct
    {
        return new MailRecipientStruct(
            [
                $this->customer->getEmail() => $this->customer->getFirstName() . ' ' . $this->customer->getLastName(),
            ]
        );
    }
}
$this->set('name', $name);
    return $this;
  }

  /** * {@inheritdoc} */
  public function getAuthorEmail() {
    $mail = $this->get('mail')->value;

    if ($this->get('uid')->target_id != 0) {
      $mail = $this->get('uid')->entity->getEmail();
    }

    return $mail;
  }

  /** * {@inheritdoc} */
  public function getHomepage() {
    return $this->get('homepage')->value;
  }

  
$this->View()->assign($errors);

            return;
        }

        $customer->setEncoderName($this->get('passwordencoder')->getDefaultPasswordEncoderName());

        $this->get('models')->persist($customer);
        $this->get('models')->flush($customer);

        // Perform a login for customer and redirect to account         $this->Request()->setPost(['email' => $customer->getEmail(), 'password' => $form->get('password')->getData()]);
        $this->admin->sLogin();

        $target = $this->Request()->getParam('sTarget');
        if (!$target) {
            $target = 'account';
        }

        $this->get(Connection::class)->executeQuery(
            'DELETE FROM s_core_optin WHERE hash = ? AND type = ?',
            [$hash, 'swPassword']
        );

        


    private function login(): KernelBrowser
    {
        $customer = $this->createCustomer();

        $browser = KernelLifecycleManager::createBrowser($this->getKernel());
        $browser->request(
            'POST',
            $_SERVER['APP_URL'] . '/account/login',
            $this->tokenize('frontend.account.login', [
                'username' => $customer->getEmail(),
                'password' => 'test12345',
            ])
        );
        $response = $browser->getResponse();
        static::assertSame(200, $response->getStatusCode()(string) $response->getContent());

        $browser->request('GET', '/');
        /** @var StorefrontResponse $response */
        $response = $browser->getResponse();
        $salesChannelContext = $response->getContext();
        static::assertNotNull($salesChannelContext);
        
->add('order', new EntityType(OrderDefinition::class));
    }

    public function getMailStruct(): MailRecipientStruct
    {
        if (!$this->mailRecipientStruct instanceof MailRecipientStruct) {
            if ($this->order->getOrderCustomer() === null) {
                throw new MailEventConfigurationException('Data for mailRecipientStruct not available.', self::class);
            }

            $this->mailRecipientStruct = new MailRecipientStruct([
                $this->order->getOrderCustomer()->getEmail() => $this->order->getOrderCustomer()->getFirstName() . ' ' . $this->order->getOrderCustomer()->getLastName(),
            ]);
        }

        return $this->mailRecipientStruct;
    }

    public function getSalesChannelId(): string
    {
        return $this->order->getSalesChannelId();
    }

    
$customer = $repository->find($mapCustomerAccountValue);

        if (!$customer) {
            return;
        }

        echo sprintf(
            '%s %s %s %s|%d',
            $customer->getNumber(),
            $customer->getFirstname() . ' ' . $customer->getLastname(),
            $customer->getDefaultBillingAddress() ? $customer->getDefaultBillingAddress()->getCompany() : '',
            $customer->getEmail(),
            $customer->getId()
        );
    }

    /** * Deletes a Partner from the database * * @return void */
    public function deletePartnerAction()
    {
        
protected $defaultTheme = 'stark';

  public function testUserSearch() {
    // Verify that a user without 'administer users' permission cannot search     // for users by email address. Additionally, ensure that the username has a     // plus sign to ensure searching works with that.     $user1 = $this->drupalCreateUser([
      'access user profiles',
      'search content',
    ], "foo+bar");
    $this->drupalLogin($user1);
    $keys = $user1->getEmail();
    $edit = ['keys' => $keys];
    $this->drupalGet('search/user');
    $this->submitForm($edit, 'Search');
    $this->assertSession()->pageTextContains('Your search yielded no results.');
    $this->assertSession()->pageTextContains('no results');

    // Verify that a non-matching query gives an appropriate message.     $keys = 'nomatch';
    $edit = ['keys' => $keys];
    $this->drupalGet('search/user');
    $this->submitForm($edit, 'Search');
    
Home | Imprint | This part of the site doesn't use cookies.