Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

New idea for remote CC

Aperta
#93 5 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
5/5
Tempo stimato
Più di una settimana
Idoneità per principianti
25/100
Tipo di issue
Funzionalità
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
php
Ambito
testing-qa

Direzione di ricerca

Inizia esaminando l’issue #85 e il flusso esistente di coverage remoto C3, incluso il modo in cui i moduli browser Selenium, REST e Php identificano attualmente le richieste. Traccia quindi il percorso del report PHP CodeCoverage e della serializzazione, poi definisci con i maintainer il comportamento della connessione, dello streaming, della pulizia e dei test paralleli prima dell’implementazione.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

After reviewing #85 (good work keep it going!) I thought of a different approach to code coverage that might work cleanly as well.

The idea:

  1. Before a test starts, connect to C3, this is a "long lived" connection. C3 creates a file temp file with a fixed name and watches it for data, this data is streamed back to the coverage module.
  2. During the test each request to the server is profiled and the serialized result (php-codecoverage library supports serialization) is atomically written to the local temp file.
  3. After the test ends we disconnect the stream from 1 and this prompts the remote coverage file to be removed

This could simplify things:

  • We no longer need to mark each request with a cookie, which needs to be set in the browser module (Selenium, REST, or Php)
  • We no longer have edge cases where fetch requests might not send cookies for example
  • We cannot support parallel tests since we won't be able to know to which test the coverage belongs

Streaming coverage

We can stream coverage for each request like this using the PHP report class (copied below since its short)

final class PHP
{
    public function process(CodeCoverage $coverage, ?string $target = null): string
    {
        $coverage->clearCache();

        $buffer = "<?php
return \unserialize(<<<'END_OF_COVERAGE_SERIALIZATION'" . PHP_EOL . serialize($coverage) . PHP_EOL . 'END_OF_COVERAGE_SERIALIZATION' . PHP_EOL . ');';

        if ($target !== null) {
            if (!strpos($target, '://') !== false) {
                Filesystem::createDirectory(dirname($target));
            }

            if (@file_put_contents($target, $buffer) === false) {
                throw new WriteOperationFailedException($target);
            }
        }

        return $buffer;
    }
}
  1. Capture it like normal
  2. Use the SebastianBergmann\CodeCoverage\Report\PHP report to process it to a string
  3. Stream the result to the calling code
  4. The calling code splits it using the end marker.
  5. Each part is deserialized to an of Coverage, which can be merged with the base coverage object via $baseCoverage->append($unserializedCoverage)`

Optionally we could do some automatic path detection which in most cases should actually be trivial.

Thoughts?

Lingua principale
PHP
Stelle
73
Fork
46
Metriche di merge delle PR
Nessuna PR unita negli ultimi 30g

Guida per i contributori

Nessuna guida per i contributori indicizzata per questo repository

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di Codeception/c3

Tutte le issue di Codeception/c3

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.