X-Git-Url: http://aleph1.co.uk/gitweb/?a=blobdiff_plain;f=web%2Fcore%2Fmodules%2Fviews%2Ftests%2Fsrc%2FFunctional%2FDefaultViewsTest.php;h=a4ae23aa487c9d517b3986f23633ef3679d15fda;hb=refs%2Fheads%2Fd864;hp=0e5c8934421dcf62551564a464372dc446361dff;hpb=a2bd1bf0c2c1f1a17d188f4dc0726a45494cefae;p=yaffs-website diff --git a/web/core/modules/views/tests/src/Functional/DefaultViewsTest.php b/web/core/modules/views/tests/src/Functional/DefaultViewsTest.php index 0e5c89344..a4ae23aa4 100644 --- a/web/core/modules/views/tests/src/Functional/DefaultViewsTest.php +++ b/web/core/modules/views/tests/src/Functional/DefaultViewsTest.php @@ -4,15 +4,14 @@ namespace Drupal\Tests\views\Functional; use Drupal\comment\CommentInterface; use Drupal\comment\Tests\CommentTestTrait; -use Drupal\Component\Utility\Unicode; use Drupal\Core\Field\FieldStorageDefinitionInterface; use Drupal\Core\Language\LanguageInterface; use Drupal\Core\Url; -use Drupal\field\Tests\EntityReference\EntityReferenceTestTrait; use Drupal\views\Views; use Drupal\comment\Entity\Comment; use Drupal\taxonomy\Entity\Vocabulary; use Drupal\taxonomy\Entity\Term; +use Drupal\Tests\field\Traits\EntityReferenceTestTrait; /** * Tests the default views provided by views. @@ -53,7 +52,7 @@ class DefaultViewsTest extends ViewTestBase { $vocabulary = Vocabulary::create([ 'name' => $this->randomMachineName(), 'description' => $this->randomMachineName(), - 'vid' => Unicode::strtolower($this->randomMachineName()), + 'vid' => mb_strtolower($this->randomMachineName()), 'langcode' => LanguageInterface::LANGCODE_NOT_SPECIFIED, 'help' => '', 'nodes' => ['page' => 'page'], @@ -62,7 +61,7 @@ class DefaultViewsTest extends ViewTestBase { $vocabulary->save(); // Create a field. - $field_name = Unicode::strtolower($this->randomMachineName()); + $field_name = mb_strtolower($this->randomMachineName()); $handler_settings = [ 'target_bundles' => [ @@ -97,9 +96,18 @@ class DefaultViewsTest extends ViewTestBase { 'status' => CommentInterface::PUBLISHED, 'entity_id' => $node->id(), 'entity_type' => 'node', - 'field_name' => 'comment' + 'field_name' => 'comment', ]; Comment::create($comment)->save(); + + $unpublished_comment = [ + 'uid' => $user->id(), + 'status' => CommentInterface::NOT_PUBLISHED, + 'entity_id' => $node->id(), + 'entity_type' => 'node', + 'field_name' => 'comment', + ]; + Comment::create($unpublished_comment)->save(); } // Some views, such as the "Who's Online" view, only return results if at @@ -165,16 +173,19 @@ class DefaultViewsTest extends ViewTestBase { // Create additional nodes compared to the one in the setup method. // Create two nodes in the same month, and one in each following month. $node = [ - 'created' => 280299600, // Sun, 19 Nov 1978 05:00:00 GMT + // Sun, 19 Nov 1978 05:00:00 GMT. + 'created' => 280299600, ]; $this->drupalCreateNode($node); $this->drupalCreateNode($node); $node = [ - 'created' => 282891600, // Tue, 19 Dec 1978 05:00:00 GMT + // Tue, 19 Dec 1978 05:00:00 GMT. + 'created' => 282891600, ]; $this->drupalCreateNode($node); $node = [ - 'created' => 285570000, // Fri, 19 Jan 1979 05:00:00 GMT + // Fri, 19 Jan 1979 05:00:00 GMT. + 'created' => 285570000, ]; $this->drupalCreateNode($node);