Support from Acquia helps fund testing for Drupal Acquia logo

Comments

ParisLiakos’s picture

Status: Active » Needs review
FileSize
606 bytes
ParisLiakos’s picture

Actually we need a check first, not all modules have this folder

ParisLiakos’s picture

hrmmm better patch

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Perfect!

alexpott’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs tests

I think we should be adding a test here to prove we can now load test classes from test modules in PHPUnit tests....

ParisLiakos’s picture

@alexpott: i already have a test that fails without this here.this issue kinda waits for this one
#1957330-25: Make possible for parsers and fetchers to expose configuration through plugins
What about closing this and commit this there?

ParisLiakos’s picture

Status: Needs work » Needs review
Issue tags: -Needs tests
FileSize
2.25 KB
1.59 KB

nevermind, here is a specific test

dawehner’s picture

I like the simplicity of the test

+++ b/core/modules/simpletest/tests/Drupal/simpletest/Tests/PhpUnitAutoloaderTest.phpundefined
@@ -0,0 +1,32 @@
+    $this->assertTrue(class_exists('\Drupal\phpunit_test\PhpUnitTestDummyClass'));

It could be helpful to provide a custom message.

ParisLiakos’s picture

true, here it is

dawehner’s picture

+++ b/core/modules/simpletest/tests/Drupal/simpletest/Tests/PhpUnitAutoloaderTest.phpundefined
@@ -26,7 +26,7 @@ public static function getInfo() {
+    $this->assertTrue(class_exists('\Drupal\phpunit_test\PhpUnitTestDummyClass'), 'Class provided by test module was not loaded');

Was not loaded? Additional there is a missing "." at the end.

ParisLiakos’s picture

Edited it manually:

  • loaded => autoloaded
  • added dot
dawehner’s picture

+++ b/core/modules/simpletest/tests/Drupal/simpletest/Tests/PhpUnitAutoloaderTest.phpundefined
@@ -0,0 +1,32 @@
+    $this->assertTrue(class_exists('\Drupal\phpunit_test\PhpUnitTestDummyClass'), 'Class provided by test module was not autoloaded.');

+++ b/core/tests/bootstrap.phpundefined
@@ -8,6 +8,13 @@
+  $test_modules_dir = __DIR__ . "/../modules/$module/tests/modules";
...
+      $loader->add('Drupal\\' . $test_module, $test_modules_dir . '/' . $test_module . "/lib");

We can use '' instead of "" here.

ParisLiakos’s picture

manually edited++

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Sorry for all the nitpicks and general lack of knowledge.

alexpott’s picture

Status: Reviewed & tested by the community » Fixed

Committed af11d7b and pushed to 8.x! Thanks!

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