hpunit
PHP Fatal error:  Class 'Symfony\Component\EventDispatcher\Tests\AbstractEventDispatcherTest' not found in /Volumes/devdisk/dev/drupal/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php on line 31

Fatal error: Class 'Symfony\Component\EventDispatcher\Tests\AbstractEventDispatcherTest' not found in /Volumes/devdisk/dev/drupal/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php on line 31

oops. Cause of #2585165: Don't include vendor test code (especially mink) in the Drupal webroot

CommentFileSizeAuthor
#2 2592367-2.patch53.25 KBalexpott

Comments

alexpott created an issue. See original summary.

alexpott’s picture

Status: Active » Needs review
Issue tags: +Quickfix
StatusFileSize
new53.25 KB

We need to investigate why DrupalCI did not report this but let's get the quick fix in first.

wim leers’s picture

How is it possible that tests did not fail for #2585165: Don't include vendor test code (especially mink) in the Drupal webroot's patch?

alexpott’s picture

@Wim Leers I think this is because PHPUnit failed during class creation... class ContainerAwareEventDispatcherTest extends AbstractEventDispatcherTest. I think there is an issue for this.

dawehner’s picture

Can't we simply copy over the existing abstract test class and be done with it?

alexpott’s picture

@dawehner I'd rather get the fix upstream and remove the dependency - we need to copy quite a few of the test fixtures and we have no idea if they might add more in the future.

alexpott’s picture

The fail is in the logs for #2585165: Don't include vendor test code (especially mink) in the Drupal webroot see https://dispatcher.drupalci.org/job/default/23686/consoleFull

21:52:44 Drupal\Tests\Component\DependencyInjection\Dumper\PhpArrayDu  35 passes                                      
21:52:44 Drupal\Tests\Component\DependencyInjection\PhpArrayContainer  49 passes                                      
21:52:44 Drupal\path\Tests\PathNodeFormTest                            19 passes                                      
21:52:44 PHP Fatal error:  Class 'Symfony\Component\EventDispatcher\Tests\AbstractEventDispatcherTest' not found in /var/www/html/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php on line 31
21:52:44 
21:52:44 Fatal error: Class 'Symfony\Component\EventDispatcher\Tests\AbstractEventDispatcherTest' not found in /var/www/html/core/tests/Drupal/Tests/Component/EventDispatcher/ContainerAwareEventDispatcherTest.php on line 31
21:52:44 FATAL Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDispatcherTest: test runner returned a non-zero error code (255).
21:52:44 Drupal\system\Tests\Path\UrlAlterFunctionalTest               33 passes                                      
21:52:44 Drupal\Tests\Component\Discovery\YamlDiscoveryTest             1 passes                                      
21:52:44 Drupal\Tests\Component\DrupalComponentTest                     6 passes                                      
21:52:45 Drupal\Tests\Component\FileCache\FileCacheTest                 4 passes  

So at least we can use DrupalCI to prove this works.

alexpott’s picture

So DrupalCI shows this is fixed... https://dispatcher.drupalci.org/job/default/23819/consoleFull

12:42:34 Drupal\Tests\Component\Discovery\YamlDiscoveryTest             1 passes                                      
12:42:34 Drupal\Tests\Component\DependencyInjection\Dumper\OptimizedP  35 passes                                      
12:42:34 Drupal\Tests\Component\DependencyInjection\Dumper\PhpArrayDu  35 passes                                      
12:42:34 Drupal\Tests\Component\DependencyInjection\PhpArrayContainer  49 passes                                      
12:42:35 Drupal\Tests\Component\DrupalComponentTest                     6 passes                                      
12:42:35 Drupal\Tests\Component\EventDispatcher\ContainerAwareEventDi  27 passes                                      
12:42:35 Drupal\Tests\Component\FileCache\FileCacheFactoryTest          4 passes                                      
12:42:35 Drupal\Tests\Component\FileCache\FileCacheTest                 4 passes                                      
12:42:35 Drupal\Tests\Component\Graph\GraphTest                         1 passes                                      
12:42:35 Drupal\Tests\Component\Gettext\PoHeaderTest                   12 passes    

I think this is a good quick stopgap to the better EventDispatcher getting in upstream.

alexpott’s picture

dawehner’s picture

Status: Needs review » Reviewed & tested by the community

Even I'm still convinced that copy over the one file would solve the same issue, and would be better this patch looks okay.
It is a quickfix so, let's be pragmatic.

dawehner’s picture

Status: Reviewed & tested by the community » Needs work

Well, as it turns out, the begging was not necessarily 100% convinced

alexpott’s picture

Status: Needs work » Reviewed & tested by the community

I tried to do what @dawehner asked but I ended up not being to just re-namespace abstract class AbstractEventDispatcherTest because testAddSubscriberWithPriorities does an instanceof check. So I thought lets override that in the ContainerAwareEventDispatcherTest but that didn't work because $dispatcher is private.

Therefore I think the current patch is (unfortunately) the way to go here. Hopefully we can remove all of this duplication when https://github.com/symfony/symfony/pull/12521 lands.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.0.x, thanks!

  • catch committed fff902e on 8.0.x
    Issue #2592367 by alexpott: PHPUnit is broken - we have dependencies on...
Mixologic’s picture

A thousand pardons. I'll spend time on #2580293: Patch having test with "PHP Fatal error" is marked as PASSED today - this normally would not happen to phpunit tests, except, in this case since the class it was extended from was removed, it had no way of knowing it was a phpunit test.

Status: Fixed » Closed (fixed)

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