Research: ConnectionInterface contract for final driver Connection classes
Maintainer antworten meist innerhalb von 1 Tag
Dieses Issue hat noch niemand übernommen.
Bewertung
- Schwierigkeit
- 5/5
- Geschätzter Aufwand
- Über eine Woche
- Anfängerfreundlichkeit
- 30/100
Rechercherichtung
Start with phpdb-mysql's test/unit/ConnectionTest.php, especially createMockConnection(), then trace the upstream interfaces and Connection::connect(), createResource(), and setResource(). Done means the resource-factory contract and approach for final driver Connection classes are decided and the PHPUnit failure mode is covered by the relevant tests.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Beschreibung
Context
Researching whether phpdb-mysql's Connection class can be made final ahead of its 1.0.0 release. This will need a resource-factory contract designed here in php-db/phpdb, since the same problem will apply to every driver package. Still tracing the upstream interfaces and deciding on an approach, not rushed.
Root cause of the test failures
phpdb-mysql's test/unit/ConnectionTest.php::createMockConnection() uses a PHPUnit partial mock:
$connection = $this->getMockBuilder(Connection::class)
->onlyMethods(['createResource'])
->setConstructorArgs([$params])
->getMock();
onlyMethods() partial mocking works by generating a real subclass of Connection at runtime with the specified method overridden. Marking Connection final breaks this, since PHP does not allow subclassing a final class. This throws:
PHPUnit\Framework\MockObject\Generator\ClassIsFinalException: Class "PhpDb\Mysql\Connection" is declared "final" and cannot be doubled
Also confirmed that calling setResource() with a fake resource before connect() does not work as a substitute. connect()'s first line is if ($this->resource instanceof mysqli) { return $this; }. Once a resource is set, connect() treats that as already connected and returns immediately, skipping the DSN and SSL flag building logic and the real_connect() call that the tests need to exercise.
- Vorherrschende Sprache
- PHP
- Sterne
- 18
- Forks
- 8
- Ø Merge
- 6 T. 11 Std.
- Gemergte PRs (30 T.)
- 14
Entwicklungsumgebung
- Enthält ein Dockerfile oder eine Docker-Compose-Datei
- Keine Pull-Request-Vorlage
- Kein Beitragsleitfaden
Erste Schritte
- Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
- Forken Sie das Repository und arbeiten Sie in einem Branch.
- Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.
Mehr aus php-db/phpdb
-
bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
RFC
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 66/100
Maintainer antworten meist innerhalb von 1 Tag
-
RFC
Schwierigkeit 5/5 Über eine Woche Anfängerfreundlichkeit 38/100
Maintainer antworten meist innerhalb von 1 Tag
-
RFC
Schwierigkeit 3/5 1-2 Tage Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
RFC
Schwierigkeit 4/5 3-5 Tage Anfängerfreundlichkeit 45/100
Maintainer antworten meist innerhalb von 1 Tag
Ähnliche Issues
-
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 68/100
Maintainer antworten meist innerhalb von 1 Tag
-
Awaiting Triage bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
Maintainer antworten meist innerhalb von 1 Tag
-
freshrss: Unable to update feedsEvtl. vergeben @Stunkymonkey hat das heute übernommen. Offen0.kind: bug
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 65/100
NixOS/nixpkgs#571043 · 1 Kommentar ·
Maintainer antworten meist innerhalb von 1 Tag
-
product / databases
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 82/100
Maintainer antworten meist innerhalb von 1 Tag
-
enhancement
Schwierigkeit 2/5 1-3 Stunden Anfängerfreundlichkeit 75/100
VilnaCRM-Org/user-service#525 ·
Maintainer antworten meist innerhalb von 21 Tagen