Due to multiple changes the groupwise max relationship doesn't work anymore.

Let's fix this in that issue and write a test for that.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dawehner’s picture

Status: Active » Needs review
Issue tags: -Needs tests
FileSize
20.82 KB

Here is a test + the actual fix for the code.

Status: Needs review » Needs work

The last submitted patch, views-1799040-1.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
22.21 KB

Cleaned up stuff and fixed the remaining issue.

dawehner’s picture

Status: Needs review » Needs work

Sadly the patch does not apply anymore.

dawehner’s picture

Status: Needs work » Needs review
FileSize
20.3 KB

Rerolled, the tests are still running fine.

aspilicious’s picture

No clue what this feature does, so I can't rly review so I just scrolled through it...

+++ b/lib/Drupal/views/Tests/Taxonomy/TaxonomyTestBase.phpundefined
@@ -124,22 +101,23 @@ class RelationshipNodeTermDataTest extends ViewTestBase {
+    $term = entity_create('taxonomy_term', array(
+      'name' => $this->randomName(),
+      'description' => $this->randomName(),
+      // Use the first available text format.
+      'format' => db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(),
+      'vid' => $this->vocabulary->vid,
+      'langcode' => LANGUAGE_NOT_SPECIFIED,
+    ));
+    taxonomy_term_save($term);

Didn't knew you had to save stuff after using entity_create, interesting...
Reading the entity_create docs I don't think we have to save it again.
And if we save it we should do $term->save()

+++ b/tests/views_test_config/config/views.view.test_groupwise_term.ymlundefined
@@ -0,0 +1,66 @@
+core: 8.0-dev

Hmm I think it's better to change this to 8.0 or whatevar we are using elsewhere

dawehner’s picture

FileSize
20.28 KB
+++ b/tests/views_test_config/config/views.view.test_groupwise_term.ymlundefined
@@ -0,0 +1,66 @@
+core: 8.0-dev

currently views uses the core version constant, so all of the views currently have this value...

Fixed your other part.

 * Constructs a new entity object, without permanently saving it.
dawehner’s picture

Project: Views (for Drupal 7) » VDC
Version: 8.x-3.x-dev »
FileSize
20.76 KB

Rerolled against all the moving.

dawehner’s picture

Project: VDC » Views (for Drupal 7)
Version: » 8.x-3.x-dev

#7 is still working against 8.x-3.x

Status: Needs review » Needs work
Issue tags: -VDC

The last submitted patch, vdc-1799040-8.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
Issue tags: +VDC

#7: views-1799040-7.patch queued for re-testing.

tim.plunkett’s picture

Status: Needs review » Needs work
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.phpundefined
@@ -161,10 +162,9 @@ public function buildOptionsForm(&$form, &$form_state) {
+    $view = new ViewExecutable($view);
+    $view->storage->addDisplay('default');
     return $view;

I would do

$view->addDisplay('default');
return $view->getExecutable();
+++ b/core/modules/views/lib/Drupal/views/Plugin/views/relationship/GroupwiseMax.phpundefined
@@ -219,20 +219,24 @@ function left_query($options) {
 
+
     // Add the base table ID field.

Extra line

+++ b/core/modules/views/lib/Drupal/views/Tests/Taxonomy/RelationshipNodeTermDataTest.phpundefined
@@ -2,7 +2,7 @@
- * Definition of Drupal\views\Tests\Taxonomy\RelationshipNodeTermDataTest.
+ * Definition of Drupal\views\Tests\Taxonomy\TaxonomyTestBase.

This looks wrong

+++ b/core/modules/views/lib/Drupal/views/Tests/Taxonomy/TaxonomyTestBase.phpundefined
@@ -22,35 +22,11 @@ class RelationshipNodeTermDataTest extends ViewTestBase {
+  public $node;

@@ -63,7 +39,8 @@ function setUp() {
+    $this->nodes[] = $this->drupalCreateNode($node);
+    $this->nodes[] = $this->drupalCreateNode($node);

These should agree

+++ b/core/modules/views/lib/Drupal/views/Tests/User/RelationshipRepresentativeNode.phpundefined
@@ -0,0 +1,50 @@
+  public static $modules = array('node');

Node is in the testing profile

dawehner’s picture

Status: Needs work » Needs review
FileSize
20.36 KB
This looks wrong

Not sure how this happened, probably i got confused by some renaming.

$view->addDisplay('default');
return $view->getExecutable();

I like that!

Fixed the other parts and added some additional documentation.

dawehner’s picture

FileSize
4.49 KB

Forgot the interdiff.txt

tim.plunkett’s picture

#13: views-1799040-13.patch queued for re-testing.

damiankloip’s picture

Status: Needs review » Needs work
+++ b/lib/Drupal/views/Tests/Taxonomy/TaxonomyTestBase.phpundefined
@@ -22,48 +22,39 @@ class RelationshipNodeTermDataTest extends ViewTestBase {
+  protected $term2;
 
   function setUp() {
     parent::setUp();
     $this->mockStandardInstall();
 
-    $this->term_1 = $this->createTerm();
-    $this->term_2 = $this->createTerm();
+    $this->term1 = $this->createTerm();
+    $this->term2 = $this->createTerm();

Nitpick: Why no underscores now?

+++ b/lib/Drupal/views/Tests/Taxonomy/TaxonomyTestBase.phpundefined
@@ -124,22 +115,23 @@ class RelationshipNodeTermDataTest extends ViewTestBase {
+  protected function createTerm() {
+    $term = entity_create('taxonomy_term', array(
+      'name' => $this->randomName(),
+      'description' => $this->randomName(),
+      // Use the first available text format.
+      'format' => db_query_range('SELECT format FROM {filter_format}', 0, 1)->fetchField(),
+      'vid' => $this->vocabulary->vid,
+      'langcode' => LANGUAGE_NOT_SPECIFIED,
+    ));
+    $term->save();
+    return $term;

I also added a createTerm method in Drupal\views\Tests\DefaultViewsTest. Should we consider moving this to one of the base classes?

Otherwise, this looks good!

dawehner’s picture

Status: Needs work » Needs review
I also added a createTerm method in Drupal\views\Tests\DefaultViewsTest. Should we consider moving this to one of the base classes?

Let's create a follow-up and create a proper test for the taxonomy view, similar to the comment test,
so we can that we exactly get the data out as we expected.

Regarding the underscore: we change things there anyway so i corrected it, so would you suggest to revert this change?

damiankloip’s picture

I'm happy with a follow up for that.

I'm not sure about the underscores. I would always use them and thought we were in general using underscores but I could totally be wrong on that :)

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community

Class properties = no underscores :)

dawehner’s picture

Status: Reviewed & tested by the community » Patch (to be ported)

Nice! Needs to be ported to the VDC sandbox

xjm’s picture

Status: Patch (to be ported) » Fixed

Looks like this is already fixed.

Automatically closed -- issue fixed for 2 weeks with no activity.