As views provides some default views they should be tested as well.

You should probably create some nodes/comments/terms etc. and just see whether the page results what you expected to do.

Below is a list of the views provided by default. The pattern is View -> displays:

Archive -> Block, Page
Backlinks -> Block, Page
Recent comments -> Block, Page #1758486: Write tests for the recent comments view.
Front page -> Feed, Page
Glossary -> Page
Taxonomy Term -> Feed, Page
Tracker -> Page

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

slv_’s picture

I may start with this today. How's the usual approach. 1 Issue per view and keep this post with an updated list, or everything within the same patch here?

dawehner’s picture

In general i don't care, take the approach which is easier for you.
It might be easier to review to have on issue per testCase.

slv_’s picture

Haven't done much of testing so far, so will take the issue per view then, so I can have some feedback quicker. Below is a list of the views provided by default, in case you want to update the Issue Summary. The pattern is View -> displays:

Archive -> Block, Page
Backlinks -> Block, Page
Recent comments -> Block, Page
Front page -> Feed, Page
Glossary -> Page
Taxonomy Term -> Feed, Page
Tracker -> Page

xjm’s picture

@slv_: You can update the issue summary too. :)

slv_’s picture

Cool, thanks!

slv_’s picture

Issue summary: View changes

Added a list of the views provided by default

damiankloip’s picture

Assigned: Unassigned » damiankloip

having a look at this now.

damiankloip’s picture

FileSize
4.68 KB

Here is what I have so far. It checks each default view display can be executed ok and has results in $view->result. The only thing that isn't working currently is the backlinks results. I haven't quite got this working yet.

I think it may also show some warnings to do with the viewExecutable patch that went in.

tim.plunkett’s picture

Status: Active » Needs review

Status: Needs review » Needs work

The last submitted patch, views-1754286.patch, failed testing.

dawehner’s picture

+++ b/lib/Drupal/views/Tests/DefaultViewsTest.phpundefined
@@ -0,0 +1,160 @@
+      foreach ($view->display as $display_id => $display) {

You need to create a $view = new ViewExecutable($view); first

damiankloip’s picture

Status: Needs work » Needs review
FileSize
6.09 KB

This will still fail, but will show the proper failures I think. We need the fixes for the bugs this test uncovers in IndexTidDepth.php and CreatedYearMonth.php. Here are some fixes for those too. Now the backlinks tests should fail.

EDIT: @tim.plunkett: I know you also had another fix for IndexTidDepth. I can't remember exactly what you did so leaving it out for now!

Status: Needs review » Needs work

The last submitted patch, 1754286-11.patch, failed testing.

tim.plunkett’s picture

That was my only fix for that handler specifically, the other thing was adding views_query_substitutions to hook_hook_info

dawehner’s picture

Status: Needs work » Needs review
FileSize
5.42 KB

You set the wrong path.

Now everything links back to node/1

Status: Needs review » Needs work

The last submitted patch, views-1754286-14.patch, failed testing.

dawehner’s picture

Status: Needs work » Needs review
FileSize
5.43 KB

Added block as module to the test.

damiankloip’s picture

Assigned: damiankloip » Unassigned
damiankloip’s picture

Now dawehner fixed the last part of the tests, I think this one is good to go. I can't RTBC my own patches thought really :)

dawehner’s picture

Issue tags: -VDC

#16: views-1754286-16.patch queued for re-testing.

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

The last submitted patch, views-1754286-16.patch, failed testing.

dawehner’s picture

FileSize
7.8 KB
13.24 KB

Some fixes were needed to get this running, see interdiff.

dawehner’s picture

Status: Needs work » Needs review

...

tim.plunkett’s picture

+++ b/lib/Drupal/views/Tests/Handler/HandlerTest.phpundefined
@@ -58,7 +57,7 @@ class HandlerTest extends ViewTestBase {
+    $empty_stdclass = new \StdClass();

Should be \stdClass(), here and elsewhere

+++ b/modules/search.views.incundefined
@@ -79,8 +79,14 @@ function search_views_data() {
+        'type' => 'INNER'
+      )
+    )

@@ -97,8 +103,14 @@ function search_views_data() {
+        'type' => 'INNER'
+      )
+    )

Missing trailing commas

dawehner’s picture

FileSize
8.25 KB

Thanks for the review! Here are the fixes for your comments

dawehner’s picture

FileSize
8.25 KB

LOL, forgot to add the actual tests.

dawehner’s picture

FileSize
13.16 KB

Oh boy.

damiankloip’s picture

Status: Needs review » Reviewed & tested by the community
dawehner’s picture

Status: Reviewed & tested by the community » Fixed

Committed and pushed

tim.plunkett’s picture

Status: Fixed » Active
tim.plunkett’s picture

Status: Active » Fixed

Ah, only the tests were committed, not the fixes.
http://drupalcode.org/project/views.git/commit/7a8919d

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

Anonymous’s picture

Issue summary: View changes

adding a link to an existing issue