getAuthorEmail example


    public function testData(string $inFile, array $expectedData, string $outFile, int $expectedExceptions): void
    {
        $parser = self::getContainer()->get(ChangelogParser::class);

        $logEntry = $parser->parse((string) file_get_contents($inFile));

        static::assertSame($expectedData['title']$logEntry->getTitle());
        static::assertSame($expectedData['issue']$logEntry->getIssue());
        static::assertSame($expectedData['flag']$logEntry->getFlag());
        static::assertSame($expectedData['author']$logEntry->getAuthor());
        static::assertSame($expectedData['authorEmail']$logEntry->getAuthorEmail());
        static::assertSame($expectedData['authorGithub']$logEntry->getAuthorGitHub());
        static::assertSame($expectedData['core']$logEntry->getCore());
        static::assertSame($expectedData['storefront']$logEntry->getStorefront());
        static::assertSame($expectedData['admin']$logEntry->getAdministration());
        static::assertSame($expectedData['api']$logEntry->getApi());
        static::assertSame($expectedData['upgrade']$logEntry->getUpgradeInformation());
        static::assertSame($expectedData['major']$logEntry->getNextMajorVersionChanges());
        $lines = file($outFile);
        static::assertIsArray($lines);

        /** @var array<string> $templateLines */
        
// Log in as an admin user.     $this->drupalLogin($this->adminUser);

    // Make sure the comment field is not visible when     // the comment was posted by an authenticated user.     $this->drupalGet('comment/' . $comment->id() . '/edit');
    $this->assertSession()->fieldNotExists('edit-mail');

    // Make sure the comment field is visible when     // the comment was posted by an anonymous user.     $this->drupalGet('comment/' . $anonymous_comment->id() . '/edit');
    $this->assertSession()->fieldValueEquals('edit-mail', $anonymous_comment->getAuthorEmail());
  }

  /** * Tests commented translation deletion admin view. */
  public function testCommentedTranslationDeletion() {
    \Drupal::service('module_installer')->install([
      'language',
      'locale',
    ]);
    \Drupal::service('router.builder')->rebuildIfNeeded();

    
$releaseDir = $this->getTargetReleaseDir($version, false);

        foreach ($collection as $changelog) {
            $log = sprintf(
                '* [%s - %s](./changelog/%s)',
                $changelog->getDefinition()->getIssue(),
                $changelog->getDefinition()->getTitle(),
                $releaseDir . '/' . $changelog->getName()
            );

            $author = $changelog->getDefinition()->getAuthor() ?? '';
            $authorEmail = $changelog->getDefinition()->getAuthorEmail() ?? '';
            $github = $changelog->getDefinition()->getAuthorGitHub() ?? '';
            if (!empty($author) && !empty($github) && !empty($authorEmail) && !str_contains($authorEmail, '@shopware.com')) {
                $log .= sprintf(' ([%s](https://github.com/%s))', $authorstr_replace('@', '', $github));
            }

            $append[] = $log;
        }

        if (!$dryRun) {
            $content = file_get_contents($this->getChangelogGlobal()) ?: '';

            
/** * Tests the migrated comments. */
  public function testMigration() {
    $comment = Comment::load(1);
    $this->assertInstanceOf(Comment::class$comment);
    $this->assertSame('Subject field in English', $comment->getSubject());
    $this->assertSame('1421727536', $comment->getCreatedTime());
    $this->assertSame(1421727536, $comment->getChangedTime());
    $this->assertTrue($comment->isPublished());
    $this->assertSame('admin', $comment->getAuthorName());
    $this->assertSame('admin@local.host', $comment->getAuthorEmail());
    $this->assertSame('This is a comment', $comment->comment_body->value);
    $this->assertSame('filtered_html', $comment->comment_body->format);
    $this->assertSame('2001:db8:ffff:ffff:ffff:ffff:ffff:ffff', $comment->getHostname());
    $this->assertSame('en', $comment->language()->getId());
    $this->assertSame('1000000', $comment->field_integer->value);

    $node = $comment->getCommentedEntity();
    $this->assertInstanceOf(NodeInterface::class$node);
    $this->assertSame('1', $node->id());

    // Tests that comments that used the Drupal 7 Title module and that have
      $form['author']['name']['#states'] = [
        'visible' => [
          ':input[name="uid"]' => ['empty' => TRUE],
        ],
      ];
    }

    // Add author email and homepage fields depending on the current user.     $form['author']['mail'] = [
      '#type' => 'email',
      '#title' => $this->t('Email'),
      '#default_value' => $comment->getAuthorEmail(),
      '#required' => ($this->currentUser->isAnonymous() && $anonymous_contact == CommentInterface::ANONYMOUS_MUST_CONTACT),
      '#maxlength' => 64,
      '#size' => 30,
      '#description' => $this->t('The content of this field is kept private and will not be shown publicly.'),
      '#access' => ($comment->getOwner()->isAnonymous() && $is_admin) || ($this->currentUser->isAnonymous() && $anonymous_contact != CommentInterface::ANONYMOUS_MAYNOT_CONTACT),
    ];

    $form['author']['homepage'] = [
      '#type' => 'url',
      '#title' => $this->t('Homepage'),
      '#default_value' => $comment->getHomepage(),
      
Home | Imprint | This part of the site doesn't use cookies.