diff --git a/core/modules/user/src/Tests/UserUsernameTest.php b/core/modules/user/src/Tests/UserUsernameTest.php deleted file mode 100644 index 7b28df3..0000000 --- a/core/modules/user/src/Tests/UserUsernameTest.php +++ /dev/null @@ -1,146 +0,0 @@ -drupalCreateContentType(array('type' => 'article')); - $this->container->get('comment.manager')->addDefaultField('node', 'article'); - - // Create user with short username. - $this->userShortName = $this->drupalCreateUser( - array( - 'access content', - 'access comments', - 'post comments', - 'skip comment approval', - 'create article content', - ), - $this->randomString(30) - ); - - // Create user with long username. - $this->userLongName = $this->drupalCreateUser( - array( - 'access content', - 'access comments', - 'post comments', - 'skip comment approval', - 'create article content', - ), - $this->randomString(31) - ); - } - - /** - * Tests author name display on nodes. - */ - public function testTruncatedNodeAuthorName() { - // Test untruncated username. - $this->drupalLogin($this->userShortName); - - $node = $this->drupalCreateNode(array('type' => 'article')); - $this->drupalGet('node/' . $node->id()); - $this->assertText(String::checkPlain($this->userShortName->getUsername()), 'Untruncated username found.'); - - // Test truncated username. - $this->drupalLogin($this->userLongName); - - $node = $this->drupalCreateNode(array('type' => 'article')); - $this->drupalGet('node/' . $node->id()); - $this->assertNoText(String::checkPlain($this->userLongName->getUsername()), 'Untruncated username not found.'); - $this->assertText(String::checkPlain(Unicode::truncate($this->userLongName->getUsername(), 29, FALSE, TRUE)), 'Truncated username found.'); - } - - /** - * Tests author name display on comments. - */ - public function testTruncatedCommentAuthorName() { - $node = $this->drupalCreateNode(array('type' => 'article')); - - $this->drupalLogin($this->userShortName); - $comment = array( - 'subject[0][value]' => $this->randomMachineName(), - 'comment_body[0][value]' => $this->randomMachineName(20), - ); - $this->drupalPostForm('comment/reply/node/' . $node->id() . '/comment', $comment, t('Save')); - $this->assertText(String::checkPlain($this->userShortName->getUsername()), 'Untruncated username found.'); - $this->drupalLogin($this->userLongName); - $comment = array( - 'subject[0][value]' => $this->randomMachineName(), - 'comment_body[0][value]' => $this->randomMachineName(20), - ); - $this->drupalPostForm('comment/reply/node/' . $node->id() . '/comment', $comment, t('Save')); - $this->assertNoText(String::checkPlain($this->userLongName->getUsername()), 'Untruncated username not found.'); - $this->assertText(String::checkPlain(Unicode::truncate($this->userLongName->getUsername(), 29, FALSE, TRUE)), 'Truncated username found.'); - } - - - /** - * Tests username display in Who's New block. - */ - public function testTruncatedWhosNewName() { - // Enable Who's New block. - $this->drupalPlaceBlock('views_block:who_s_new-block_1'); - - $this->drupalGet(''); - - // The Who's new block requires a last access to be set. - // Log the users in for them to show up. - $this->drupalLogin($this->userShortName); - $this->drupalLogin($this->userLongName); - // Log user out to prevent a false negative - $this->drupalLogout(); - - $this->assertText(String::checkPlain($this->userShortName->getUsername()), 'Untruncated username found.'); - $this->assertNoText(String::checkPlain($this->userLongName->getUsername()), 'Untruncated username not found.'); - $this->assertText(String::checkPlain(Unicode::truncate($this->userLongName->getUsername(), 29, FALSE, TRUE)), 'Truncated username found.'); - } - -} \ No newline at end of file