oerdnj / deb.sury.org

Public bugreports for anything ppa:ondrej/*
801 stars 26 forks source link

phpdbg executes code incorrectly #485

Closed deviantintegral closed 7 years ago

deviantintegral commented 7 years ago

I've been attempting to use phpdbg for code coverage reports with phpunit. I've had rather strange behaviour with it running Drupal 8's test suite. phpunit 4.8 tests simply stop running, with no error or segfault. I switched over to phpunit 5.4, so the warnings below can be ignored for now.

Under PHP 7, tests pass, but on further inspection, the assertions are not all being run correctly:

$ sudo -u www-data  vendor/bin/phpunit -c core/phpunit.xml --group aggregator --debug --verbose
PHPUnit 5.6.2 by Sebastian Bergmann and contributors.

Runtime:       PHP 7.0.12-1+deb.sury.org~trusty+1
Configuration: /var/www/docroot/core/phpunit.xml
Warning:       Deprecated configuration setting "checkForUnintentionallyCoveredCode" used

Starting test 'Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorAdminLocalTasks with data set #0 ('aggregator.admin_overview')'.
W
Starting test 'Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorAdminLocalTasks with data set #1 ('aggregator.admin_settings')'.
W
Starting test 'Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorSourceLocalTasks with data set #0 ('entity.aggregator_feed.canonical')'.
W
Starting test 'Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorSourceLocalTasks with data set #1 ('entity.aggregator_feed.edit_form')'.
W
Starting test 'Drupal\Tests\aggregator\Unit\Plugin\AggregatorPluginSettingsBaseTest::testSettingsForm'.
W
Starting test 'Drupal\Tests\aggregator\Kernel\FeedValidationTest::testValidation'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\ItemWithoutFeedTest::testEntityCreation'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Migrate\d7\MigrateAggregatorSettingsTest::testMigration'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Migrate\MigrateAggregatorStubTest::testFeedStub'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Migrate\MigrateAggregatorStubTest::testItemStub'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Plugin\migrate\source\AggregatorFeedTest::testSource with data set #0 (array(array(array(1, 'feed title 1', 'http://example.com/feed.rss', 900, 0, 'http://example.com', 'A vague description', '', '', 0, 5), array(2, 'feed title 2', 'http://example.net/news.rss', 1800, 0, 'http://example.net', 'An even more vague description', '', '', 0, 5))), array(array(1, 'feed title 1', 'http://example.com/feed.rss', 900, 0, 'http://example.com', 'A vague description', '', '', 0, 5), array(2, 'feed title 2', 'http://example.net/news.rss', 1800, 0, 'http://example.net', 'An even more vague description', '', '', 0, 5)))'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Plugin\migrate\source\AggregatorItemTest::testSource with data set #0 (array(array(array(1, 1, 'This (three) weeks in Drupal ...h 2014', 'https://groups.drupal.org/node/395218', 'larowlan', '<h2 id='new'>What's new with ...?</h2>', 1389297196, '395218 at https://groups.drupal.org'))), array(array(1, 1, 'This (three) weeks in Drupal ...h 2014', 'https://groups.drupal.org/node/395218', 'larowlan', '<h2 id='new'>What's new with ...?</h2>', 1389297196, '395218 at https://groups.drupal.org')))'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Views\AggregatorFeedViewsFieldAccessTest::testAggregatorFeedFields'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Views\AggregatorItemViewsFieldAccessTest::testAggregatorItemFields'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Views\IntegrationTest::testAggregatorItemView'.
.                                                   15 / 15 (100%)

Time: 44.26 seconds, Memory: 142.00MB

There were 5 warnings:

1) Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorAdminLocalTasks with data set #0 ('aggregator.admin_overview')
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

2) Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorAdminLocalTasks with data set #1 ('aggregator.admin_settings')
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

3) Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorSourceLocalTasks with data set #0 ('entity.aggregator_feed.canonical')
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

4) Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorSourceLocalTasks with data set #1 ('entity.aggregator_feed.edit_form')
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

5) Drupal\Tests\aggregator\Unit\Plugin\AggregatorPluginSettingsBaseTest::testSettingsForm
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

WARNINGS!
Tests: 15, Assertions: 176, Warnings: 5.

Note that somehow, only 8 assertions are being logged when running under phpdbg.

$ sudo -u www-data phpdbg -rrq vendor/bin/phpunit -c core/phpunit.xml --group aggregator --debug --verbose
PHPUnit 5.6.2 by Sebastian Bergmann and contributors.

Runtime:       PHPDBG 7.0.12-1+deb.sury.org~trusty+1
Configuration: /var/www/docroot/core/phpunit.xml
Warning:       Deprecated configuration setting "checkForUnintentionallyCoveredCode" used

Starting test 'Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorAdminLocalTasks with data set #0 ('aggregator.admin_overview')'.
W
Starting test 'Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorAdminLocalTasks with data set #1 ('aggregator.admin_settings')'.
W
Starting test 'Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorSourceLocalTasks with data set #0 ('entity.aggregator_feed.canonical')'.
W
Starting test 'Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorSourceLocalTasks with data set #1 ('entity.aggregator_feed.edit_form')'.
W
Starting test 'Drupal\Tests\aggregator\Unit\Plugin\AggregatorPluginSettingsBaseTest::testSettingsForm'.
W
Starting test 'Drupal\Tests\aggregator\Kernel\FeedValidationTest::testValidation'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\ItemWithoutFeedTest::testEntityCreation'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Migrate\d7\MigrateAggregatorSettingsTest::testMigration'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Migrate\MigrateAggregatorStubTest::testFeedStub'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Migrate\MigrateAggregatorStubTest::testItemStub'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Plugin\migrate\source\AggregatorFeedTest::testSource with data set #0 (array(array(array(1, 'feed title 1', 'http://example.com/feed.rss', 900, 0, 'http://example.com', 'A vague description', '', '', 0, 5), array(2, 'feed title 2', 'http://example.net/news.rss', 1800, 0, 'http://example.net', 'An even more vague description', '', '', 0, 5))), array(array(1, 'feed title 1', 'http://example.com/feed.rss', 900, 0, 'http://example.com', 'A vague description', '', '', 0, 5), array(2, 'feed title 2', 'http://example.net/news.rss', 1800, 0, 'http://example.net', 'An even more vague description', '', '', 0, 5)))'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Plugin\migrate\source\AggregatorItemTest::testSource with data set #0 (array(array(array(1, 1, 'This (three) weeks in Drupal ...h 2014', 'https://groups.drupal.org/node/395218', 'larowlan', '<h2 id='new'>What's new with ...?</h2>', 1389297196, '395218 at https://groups.drupal.org'))), array(array(1, 1, 'This (three) weeks in Drupal ...h 2014', 'https://groups.drupal.org/node/395218', 'larowlan', '<h2 id='new'>What's new with ...?</h2>', 1389297196, '395218 at https://groups.drupal.org')))'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Views\AggregatorFeedViewsFieldAccessTest::testAggregatorFeedFields'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Views\AggregatorItemViewsFieldAccessTest::testAggregatorItemFields'.
.
Starting test 'Drupal\Tests\aggregator\Kernel\Views\IntegrationTest::testAggregatorItemView'.
.                                                   15 / 15 (100%)

Time: 26.06 seconds, Memory: 164.00MB

There were 5 warnings:

1) Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorAdminLocalTasks with data set #0 ('aggregator.admin_overview')
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

2) Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorAdminLocalTasks with data set #1 ('aggregator.admin_settings')
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

3) Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorSourceLocalTasks with data set #0 ('entity.aggregator_feed.canonical')
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

4) Drupal\Tests\aggregator\Unit\Menu\AggregatorLocalTasksTest::testAggregatorSourceLocalTasks with data set #1 ('entity.aggregator_feed.edit_form')
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

5) Drupal\Tests\aggregator\Unit\Plugin\AggregatorPluginSettingsBaseTest::testSettingsForm
PHPUnit_Framework_TestCase::getMock() is deprecated, use PHPUnit_Framework_TestCase::createMock() or PHPUnit_Framework_TestCase::getMockBuilder() instead

WARNINGS!
Tests: 15, Assertions: 8, Warnings: 5.

I'm happy to report this upstream, but figured I'd start here since I'm using these packages.

oerdnj commented 7 years ago

Upstream would be definitely a better place to report this, as I don't think there's anything special about phpdbg in PPA packages. Please report the upstream bug URL here back, so we can track the progress.

deviantintegral commented 7 years ago

I replicated against 7.1RC5: https://bugs.php.net/bug.php?id=73484

Llbe commented 7 years ago

@deviantintegral Please close this issue as the upstream bug has been resolved.

This was a bug in PHPUnit.