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

Different results if I run one test and all test in same time

Aperta
#17 6 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Bug
Chiarezza
Da chiarire
Stato di attività
Ferma
Stack tecnologico
php
Ambito
database, testing

Direzione di ricerca

Riproduci il problema eseguendo i comandi dei test funzionali Codeception per un singolo file e per un'intera directory mostrati nel report. Leggi i metodi _before() dei Cest e la configurazione di ZF2, Doctrine2, DataFactory e della pulizia. Il lavoro è completato quando gli stessi test producono risultati coerenti se eseguiti singolarmente o come suite.

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

Descrizione

What are you trying to achieve?

Right now, I have some strange behaviour while running functional tests. If I run one file codecept run functional /FunctionalFolder/Services/ServiceOneCest, all tests are success - as expected. But in secound case, when I run all created tests codecept run functional /FunctionalFolder, some tests are finished as expected, while some others are failed.

Somehow, in _before() section, are not executed all dependeces.

class ServiceOneCest
{
public function _before(FunctionalTester $I)
 {
            $this->entityManager = $I->grabServiceFromContainer(EntityManager::class);
            $this->entity = $this->entityManager->getRepository(Entity::class)
            ->findOneBy([
                'name' => 'test'
            ]);
         
        if (!$this->entity) {
            $this->entity = $I->have(Entity::class, ['name' => 'test']);
        }
}

public function testSomething(FunctionalTester $I)
{
      $I->assertEquals('test', $this->entity->getName());
      // here I catch error message [Error] Call to a member function getName() on null
      // it only happend when I run more then one test file
}
}

//also exist some other test file

class ServiceTwoCest
{
}

I expect same results if I run one test file or more. I need to say, don't have any dependece between test data created in _before()

Please, if you see any reason or my bad code/configuration anything, give me handsup. If you have some other questions, please feel free to contact me.

Details
  • Codeception version: 2.5.1
  • PHP Version:PHP 7.1.25
  • Operating System: ubuntu16.04.1 (on vagrant)
  • Installation type: Phar || Composer
  • List of installed packages (composer show)
  • Suite configuration:
actor: FunctionalTester
modules:
    enabled:
        - ZF2
        - Asserts
        - \Helper\Functional
        - Doctrine2:
            depends: ZF2
        - DataFactory:
            depends: Doctrine2
        - \Helper\Factories
    config:
        Doctrine2:
            cleanup: true
Lingua principale
PHP
Stelle
4
Fork
2
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/module-doctrine

Tutte le issue di Codeception/module-doctrine

Issue simili

Altre issue su PHP

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.