Problem/Motivation

Notice: Undefined variable: phpunit_tests in simpletest_run_tests() (line 143 of core/modules/simpletest/simpletest.module).
Recoverable fatal error: Argument 2 passed to simpletest_run_phpunit_tests() must be of the type array, null given, called in /var/www/d8/core/modules/simpletest/simpletest.module on line 143 and defined in simpletest_run_phpunit_tests() (line 192 of core/modules/simpletest/simpletest.module).

Proposed resolution

Remaining tasks

User interface changes

API changes

Comments

dawehner’s picture

Issue tags: +Quickfix
StatusFileSize
new582 bytes

Simple fix

dawehner’s picture

Status: Active » Needs review

.

sun’s picture

Status: Needs review » Reviewed & tested by the community
Issue tags: +Quick fix
alexpott’s picture

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

We should have tests for this. I would prefer to get in #2272879: Can not run a WebTestBase or KernelTest base tests from inside a simpletest first and then add the test to same test that tests web tests and kernel tests.

fietserwin’s picture

I can confirm that the patch solves the problem. So +1 on that part for RTBC.

sun’s picture

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

We shouldn't introduce tests for the Simpletest UI → PHPUnit process execution chain of the test runner itself. There are none yet, and hopefully there won't be any. Instead, we should refactor that code path, or remove it entirely. (I'm currently working on the latter.)

alexpott’s picture

Then why are we fixing this if we don't intend to support it?

dawehner’s picture

Well, unless you know this issue getting a fatal during working on some random code is a bit annoying.

alexpott’s picture

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

As long we allow for me people to run tests through the UI I think we should test it - or we'll break it like we have here. In order to remove PHPUnit from the UI we need consensus about whether or not we should have a test running UI. Being able to run some tests through the UI and not others does not make sense.

sun’s picture

FWIW, Drupal 3, 4.6, 4.7, 5, and 6 survived without tests. — The edge-case functionality in question exists and is used by developers only. Developers can fix bugs.

Drupal core has developed an unhealthy passion of rigidly applying patterns everywhere. There are exceptions to the rule; the idiom exists for a reason.

Not adding test coverage for this doesn't have to imply that the functionality isn't supported. It means that it's not worth to add tests, not more, not less.


However, if anyone wants to take this on - unfortunately, you'll have to mock the entire PHPUnit framework in order to test the procedural function in question.

joelpittet’s picture

I do agree with @sun and @alexpott's points. I just want this fixed though... if you can point to what or how to test I'll try to write a test but I don't really know to test this.

I gave it a quick stab and ran into PHPUnit not having access to drupal_realpath(). Is there an example someplace of how to get acces to those methods or do you just include core/includes/file.inc in the test, or do some sort of partial bootstrap?

My plan was to just provide some fake php unit xml file and get the result rows for simpletest_run_phpunit_tests().

alexpott’s picture

Status: Needs work » Needs review
StatusFileSize
new16.8 KB
new16.23 KB

@joelpittet #2272879: Can not run a WebTestBase or KernelTest base tests from inside a simpletest shows how to test the Simpletetest UI - i've included this patch there and added a test. I suggest we close this issue and move the fix to that one.

Status: Needs review » Needs work

The last submitted patch, 12: 2306649.from-2272879.12-test-only.patch, failed testing.

joelpittet’s picture

Status: Needs work » Needs review

That looks much more elaborate than what I'd have done.

clemens.tolboom’s picture

The patch from #1 took me some more time to find out as I got

[Mon Aug 04 14:04:31 2014] [error] [client 127.0.0.1] Exception thrown when handling an exception (Symfony\\Component\\DependencyInjection\\Exception\\ServiceCircularReferenceException: Circular reference detected for service "menu.link_tree", path: "menu.link_tree".)

which is not cool.

This was introduced aka not fixed in #697760: Replace getInfo() in tests with native phpDoc + annotations (following PHPUnit)

@alexpott please commit #1 as this is a DX wtf.

fwiw I came from #1934508: Cache clear doesn't affect logo or favicon where the test bot failed to run a phpunit test so switched on simpletest to run it.

alexpott’s picture

clemens.tolboom’s picture

Status: Needs review » Closed (duplicate)

I finally got it ... running a unittest through simpletest is bad. #1934508: Cache clear doesn't affect logo or favicon has a global function fix in \Drupal\system\Tests\Asset\CssCollectionRendererUnitTest to mockup file_create_url which behaves differently.

@joelpittet I close this issue (not really a duplicate) now that #2272879: Can not run a WebTestBase or KernelTest base tests from inside a simpletest has the fix in it too and @alexpott wants us to close this issue and review the other :)