Loading
bug: #3631465: Remove the code deprecated in Mapillary Module
Removes the compatibility layer deprecated in 1.0.0-alpha6 and makes the tests run without PHPUnit 12 notices.
Removed
- The old class files in
mapillary_field/src/:Service/MapillaryApiClient.php,Service/MapillaryImageImporter.php,Event/MapillaryApiCallEvent.php,Exception/MissingAccessTokenException.php. - The four
class_alias()calls at the bottom of the new class files. - The service aliases
mapillary_field.api_clientandmapillary_field.image_importer. - The old constructor signatures of
MapillaryApiClient,MapillaryImageImporter,MapillaryMapFeatureImporterandMapillaryDetectionImporter: no union type, no$legacyLogger, noInvalidArgumentExceptionfor the old argument order. MapillaryImageImporter::importSequence(). Callers useimportSequenceMetadata($id)->entityand queue the images withmapillary_field.sequence_cascade_queuer. Its note on thesequence_idnatural key moved to theimportSequenceMetadata()docblock.MapillaryThumbnailRefresher::isServiceWideFailure();MapillaryApiException::isServiceWide()replaces it and is tested inMapillaryApiExceptionTest.MapillaryLeafletWidgetBase::GRAPH_BASE_URL; useMapillaryBrowserSettings::GRAPH_BASE_URL.- The tests of the compatibility layer:
LegacyApiClassNamesTest,LegacyApiClientServiceTest,MapillaryThumbnailRefresherFailureTest, and the legacy methods inMapillaryApiClientTest, the kernelImageImporterTestand the unitMapillaryImageImporterTest. Besides the methods listed in the issue,MapillaryApiClientTest::testLegacyConstructorWithoutDispatcher()is removed too: it tested theInvalidArgumentExceptionof the old signature.
CHANGELOG.md has a "Removed" section under [Unreleased], and AGENTS.md no longer describes the compatibility layer.
Test doubles
- A double that only returns values is created with
createStub(). - Where a mock checked its arguments with
->with()but had noexpects(), it stays a mock and gets the call count of the real flow (once(),exactly(n)).with()on a stub has no effect and is deprecated in PHPUnit 12. - Doubles shared from
setUp()are stubs by default; a test that checks a call asks for a mock through a small helper (for examplemockStorage(),mockApiClient()), and the subject is built after the doubles (importer(),worker(),queuer()). #[AllowMockObjectsWithoutExpectations]andexpects($this->any())are not used.- No existing assertion or
expects()was removed.
Upgrade
No update hook. A site on 1.0.0-alpha6 already builds the services from the new definitions; the constructor arguments in the service files did not change. Sites on 1.0.0-alpha5 or older update to 1.0.0-alpha6 and run drush updatedb first, as the changelog says.
Testing
Unit and kernel tests, run locally:
- Drupal 11 with PostgreSQL, PHPUnit 11.5: all pass.
- Drupal 12.0.0-beta1, PHP 8.5, PHPUnit 12.5.39, SQLite: all pass, with no "No expectations were configured" notices (289 before) and no "Using with*() on a test stub" deprecations. The exception is
MapillaryFieldCommandsTest, which errors there because Drush cannot be installed on Drupal 12 yet (Class "Drush\Commands\DrushCommands" not found), so its notices could not be checked; it passes on Drupal 11.
phpcs (Drupal, DrupalPractice) and PHPStan level 6 report nothing new on the changed files.
Not run locally: functional and FunctionalJavascript tests, and the update rehearsal from 1.0.0-alpha6.
Closes #3631465