stable

Clone or download

Read-only

request #13124: Ensure no mock from Mockery are created in PHPUnit data providers

Data providers are executed before the running the first test of the test suite. Consequently, if the first test that is played does not use the MockeryPHPUnitIntegration trait the test will be marked as failed because the listener Mockery\Adapter\Phpunit\TestListener will detect that Mockery has not been "closed". Also the usage of mocks in a data provider can result in weird behaviors when some expectations are defined: expectation counts will not be set on the right test or test can ran fine when executed individually but fails when executed with the rest of the test suite. You can see the issue by executing the test suite in a random order with the seed 1553005143. Change-Id: Ie41e0e7b059de0323c9739b7f83bdc7134fc1f7d

Modified Files

Name
M plugins/tracker/phpunit/Tracker/Notifications/Settings/UserNotificationSettingsTest.php +4 −6 Go to diff View file
A tests/lib/PHPUnit/NoMockeryMockInDataProviderExtension.php +41 −0 Go to diff View file
M tests/phpunit/common/Project/REST/UserRESTReferenceRetrieverTest.php +6 −2 Go to diff View file
M tests/phpunit/common/Project/Webhook/ProjectCreatedPayloadTest.php +9 −8 Go to diff View file
M tests/phpunit/phpunit.xml +3 −0 Go to diff View file
A tests/phpunit/tests/PHPUnit/NoMockeryMockInDataProviderExtensionTest.php +48 −0 Go to diff View file