Because it's a good idea. xjm++

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

xjm’s picture

Issue tags: +Novice

Nice novice task. If any of tim.plunkett, dawehner, damiankloip, or aspilicious do this, I will tease you mercilessly.

damiankloip’s picture

Must..try...to...resist.... Need... more...views..tests...

fastangel’s picture

tim.plunkett’s picture

That's a WebTest, not a UnitTest. This should still be done separately.

fastangel’s picture

Status: Active » Needs review
FileSize
1.57 KB

I attached the path with the test.

tim.plunkett’s picture

+++ b/lib/Drupal/views/Tests/PluginWebTest.phpundefined
@@ -0,0 +1,68 @@
+namespace Drupal\views\Tests;
+use Drupal\views\ViewExecutable;

Need space between lines

+++ b/lib/Drupal/views/Tests/PluginWebTest.phpundefined
@@ -0,0 +1,68 @@
+use Drupal\simpletest\WebTestBase;
...
+class PluginWebTest extends WebTestBase {

This should be UnitTestBase

+++ b/lib/Drupal/views/Tests/PluginWebTest.phpundefined
@@ -0,0 +1,68 @@
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('views');
...
+  protected function setUp() {
+    parent::setUp();
+    $this->pluginTypes = ViewExecutable::getPluginTypes();
+  }
+  /**
+   * Tests the plugins list is correct.

Do we need this in setUp? I think we should just use the method in the class.

+++ b/lib/Drupal/views/Tests/PluginWebTest.phpundefined
@@ -0,0 +1,68 @@
+    $diff = array_diff($plugin_list, $this->pluginTypes);
+    $this->assertTrue(empty($diff), 'The plugin list is correct'); ¶
+  }

Needs a blank line before the final }, after the method

+++ b/lib/Drupal/views/Tests/PluginWebTest.phpundefined
@@ -0,0 +1,68 @@
+    $this->assertTrue(empty($diff), 'The plugin list is correct'); ¶

Trailing whitespace

fastangel’s picture

FileSize
1.4 KB

New patch with all changes.

damiankloip’s picture

Status: Needs review » Needs work

Patch and code style is looking good. Just a couple o' things...

+++ b/lib/Drupal/views/Tests/PluginWebTest.phpundefined
@@ -0,0 +1,61 @@
+class PluginWebTest extends UnitTestBase {

Not sure I like the name PluginWebTest, and none of our other tests use this naming. Maybe we could go with PluginTypeTest or PluginTypeListTest maybe? I think I would favour the latter, as we also have other tests testing plugin types.

+++ b/lib/Drupal/views/Tests/PluginWebTest.phpundefined
@@ -0,0 +1,61 @@
+    );
+    $diff = array_diff($plugin_list, ViewExecutable::getPluginTypes());

I usually like a space in between stuff like this. Really nitpicky I know!

fastangel’s picture

Status: Needs work » Needs review
FileSize
1.43 KB

Done. Change the name to PluginTypeListTest and modified the space.

dawehner’s picture

Status: Needs review » Needs work
+++ b/lib/Drupal/views/Tests/PluginTypeListTest.phpundefined
@@ -0,0 +1,62 @@
+  /**
+   * Modules to enable.
+   *
+   * @var array
+   */
+  public static $modules = array('views');

You don't need this part, as the module will not be enabled at all.

The rest looks perfect.

fastangel’s picture

Status: Needs work » Needs review
FileSize
1.32 KB

New patch.

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Great, let's wait for the bot to finish.

damiankloip’s picture

Status: Reviewed & tested by the community » Fixed

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