Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Inconsistent Results between find and grabFromDatabase #6682

Open
Clasyc opened this issue Aug 5, 2023 · 1 comment
Open

Inconsistent Results between find and grabFromDatabase #6682

Clasyc opened this issue Aug 5, 2023 · 1 comment

Comments

@Clasyc
Copy link

Clasyc commented Aug 5, 2023

What are you trying to achieve?

I am attempting to receive an entity with the most recent data written on the API test, but I'm encountering incorrect or inconsistent results between find and grabFromDatabase.

I expect to see the same $path property value on the File entity in my tests, whether I access it through the entity object or perform a direct check on the database. The strangest part is that this failure only happens when I run all 150 or so of my tests, which are not related in any way and has no parallel running tests. If I run only some similar tests from a single directory (around 30 test), they all pass as they should. It's worth noting that these tests have been working fine for a long time without any issues. However, after some recent minor updates in the composer, they began to fail.

Originally, I was using Codeception 4 and thought this might be a bug, so I upgraded to Codeception 5 and all related modules. However, the problem persists.

I've checked the database after the failing test and data is correct, but Doctrine returns invalid data from previous tests.

This peculiar behavior has been observed throughout our project for some time, but in one way or another, we decided not to mix Doctrine and Codeception database methods. However, we are now in a situation where we need to use both. What are possible reasons for this?

What do you get instead?

class CreateJobRequestCest
{
    public function _before(ApiTester $I): void
    {
        $this->user = $I->grabImporterUser(self::API_KEY);
    }

    public function uploadJobFile(ApiTester $I): void
    {
        $I->wantTo('Send the file');
        $I->amConnectedToDatabase('db2');
        $I->dontSeeInDatabase('job_requests', ['status' => 'queued']);
        $I->haveHttpHeader(ApiTokenAuthenticator::API_TOKEN_HEADER, self::API_KEY);
        $I->sendPost(self::PATH, [], ['file' => codecept_data_dir('files/job.json')]);

        $I->seeResponseCodeIs(Response::HTTP_CREATED);
        $I->seeInDatabase('job_requests', ['status' => 'queued']);

        $decodedResponse = json_decode($I->grabResponse());

        $jobRepo = $I->grabRepository(JobRequestRepository::class);
        $fileRepo = $I->grabRepository(FileRepository::class);
        $job = $jobRepo->find($decodedResponse->id);
        $file = $fileRepo->find($decodedResponse->file->id);
        $path = $I->grabFromDatabase('files', 'path', ['id' => $decodedResponse->file->id]);
     }
 }

In the example above, when I print out $file->path and $path, I see different results. $file->path contains incorrect data, which appears to be from earlier similar tests that ran before this one. I am perplexed as to how this could be possible. I have been debugging this for hours without any clear reason for this occurrence. Could it be that I am not supposed to use grabFromDatabase and Doctrine repository in a single test?

Details

  • Codeception version: Codeception 5
  • PHP Version: 8.1.10
  • Operating System: Ubuntu 20
  • Installation type: Composer
  • List of installed packages (composer show)
amphp/amp                             v2.6.2    A non-blocking concurrency framework for PHP applications.
amphp/byte-stream                     v1.8.1    A stream abstraction to make working with non-blocking I/O simple.
api-platform/core                     v2.7.14   Build a fully-featured hypermedia or GraphQL API in minutes!
async-aws/core                        1.19.0    Core package to integrate with AWS. This is a lightweight AWS SDK provider by AsyncAws.
async-aws/ses                         1.5.0     SES client, part of the AWS SDK provided by AsyncAws.
async-aws/sqs                         1.8.0     SQS client, part of the AWS SDK provided by AsyncAws.
aws/aws-crt-php                       v1.2.2    AWS Common Runtime for PHP
aws/aws-sdk-php                       3.277.9   AWS SDK for PHP - Use Amazon Web Services in your PHP project
beberlei/doctrineextensions           v1.3.0    A set of extensions to Doctrine 2 that add support for additional query functions available in MySQL, Oracle, PostgreSQL and SQLite.
behat/gherkin                         v4.9.0    Gherkin DSL parser for PHP
behat/transliterator                  v1.5.0    String transliterator
clue/stream-filter                    v1.6.0    A simple and modern approach to stream filtering in PHP
codeception/codeception               5.0.10    BDD-style testing framework
codeception/lib-asserts               2.1.0     Assertion methods used by Codeception core and Asserts module
codeception/lib-innerbrowser          4.0.0     Parent library for all Codeception framework modules and PhpBrowser
codeception/lib-web                   1.0.2     Library containing files used by module-webdriver and lib-innerbrowser or module-phpbrowser
codeception/lib-xml                   1.0.1     Files used by module-rest and module-soap
codeception/module-asserts            3.0.0     Codeception module containing various assertions
codeception/module-db                 3.1.0     DB module for Codeception
codeception/module-doctrine2          3.0.3     Doctrine2 module for Codeception
codeception/module-phpbrowser         3.0.0     Codeception module for testing web application over HTTP
codeception/module-rest               3.3.2     REST module for Codeception
codeception/module-symfony            3.1.1     Codeception module for Symfony framework
codeception/stub                      4.1.0     Flexible Stub wrapper for PHPUnit's Mock Builder
composer/pcre                         3.1.0     PCRE wrapping library that offers type-safe preg_* replacements.
composer/semver                       3.3.2     Semver library that offers utilities, version constraint parsing and validation.
composer/xdebug-handler               3.0.3     Restarts a process without Xdebug.
damienharper/auditor                  2.4.7     The missing audit log library.
damienharper/auditor-bundle           5.2.4     Integrate auditor library in your Symfony projects.
dnoegel/php-xdg-base-dir              v0.1.1    implementation of xdg base directory specification for php
doctrine/annotations                  1.14.3    Docblock Annotations Parser
doctrine/cache                        2.2.0     PHP Doctrine Cache library is a popular cache implementation that supports many different drivers such as redis, memcache, apc, mongodb and others.
doctrine/collections                  1.8.0     PHP Doctrine Collections library that adds additional functionality on top of PHP arrays.
doctrine/common                       3.4.3     PHP Doctrine Common project is a library that provides additional functionality that other Doctrine projects depend on such as better reflection support, proxies and much more.
doctrine/data-fixtures                1.6.6     Data Fixtures for all Doctrine Object Managers
doctrine/dbal                         3.6.5     Powerful PHP database abstraction layer (DBAL) with many features for database schema introspection and management.
doctrine/deprecations                 v1.1.1    A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.
doctrine/doctrine-bundle              2.10.1    Symfony DoctrineBundle
doctrine/doctrine-fixtures-bundle     3.4.4     Symfony DoctrineFixturesBundle
doctrine/doctrine-migrations-bundle   3.2.4     Symfony DoctrineMigrationsBundle
doctrine/event-manager                1.2.0     The Doctrine Event Manager is a simple PHP event system that was built to be used with the various Doctrine projects.
doctrine/inflector                    2.0.8     PHP Doctrine Inflector is a small library that can perform string manipulations with regard to upper/lowercase and singular/plural forms of words.
doctrine/instantiator                 1.5.0     A small, lightweight utility to instantiate objects in PHP without invoking their constructors
doctrine/lexer                        1.2.3     PHP Doctrine Lexer parser library that can be used in Top-Down, Recursive Descent Parsers.
doctrine/migrations                   3.6.0     PHP Doctrine Migrations project offer additional functionality on top of the database abstraction layer (DBAL) for versioning your database schema and easily deploying changes to it. It is a very easy to use and a powerful tool.
doctrine/orm                          2.13.0    Object-Relational-Mapper for PHP
doctrine/persistence                  3.2.0     The Doctrine Persistence project is a set of shared interfaces and functionality that the different Doctrine object mappers share.
doctrine/sql-formatter                1.1.3     a PHP SQL highlighting library
egulias/email-validator               3.2.6     A library for validating emails against several RFCs
fakerphp/faker                        v1.23.0   Faker is a PHP library that generates fake data for you.
felixfbecker/advanced-json-rpc        v3.2.1    A more advanced JSONRPC implementation
felixfbecker/language-server-protocol v1.5.2    PHP classes for the Language Server Protocol
fidry/cpu-core-counter                0.5.1     Tiny utility to get the number of CPU cores.
friendsofphp/proxy-manager-lts        v1.0.16   Adding support for a wider range of PHP versions to ocramius/proxy-manager
gedmo/doctrine-extensions             v3.12.0   Doctrine behavioral extensions
giggsey/libphonenumber-for-php        8.13.18   PHP Port of Google's libphonenumber
giggsey/locale                        2.4       Locale functions required by libphonenumber-for-php
guzzlehttp/guzzle                     7.7.0     Guzzle is a PHP HTTP client library
guzzlehttp/promises                   1.5.3     Guzzle promises library
guzzlehttp/psr7                       2.6.0     PSR-7 message implementation that also provides common utility methods
halaxa/json-machine                   1.1.3     Efficient, easy-to-use and fast JSON pull parser
http-interop/http-factory-guzzle      1.2.0     An HTTP Factory using Guzzle PSR7
jean85/pretty-package-versions        2.0.5     A library to get pretty versions strings of installed dependencies
jms/metadata                          2.8.0     Class/method/property metadata management in PHP
jms/serializer                        3.24.0    Library for (de-)serializing data of any complexity; supports XML, and JSON.
jms/serializer-bundle                 5.3.1     Allows you to easily serialize, and deserialize data of any complexity
justinrainbow/json-schema             5.2.12    A library to validate a json schema.
knpuniversity/oauth2-client-bundle    v2.15.0   Integration with league/oauth2-client to provide services
laminas/laminas-code                  4.11.0    Extensions to the PHP Reflection API, static code scanning, and code generation
league/flysystem                      3.15.1    File storage abstraction for PHP
league/flysystem-aws-s3-v3            3.15.0    AWS S3 filesystem adapter for Flysystem.
league/flysystem-local                3.15.0    Local filesystem adapter for Flysystem.
league/html-to-markdown               5.1.1     An HTML-to-markdown conversion helper for PHP
league/mime-type-detection            1.12.0    Mime-type detection for Flysystem
league/oauth2-client                  2.7.0     OAuth 2.0 Client Library
league/oauth2-facebook                2.2.0     Facebook OAuth 2.0 Client Provider for The PHP League OAuth2-Client
league/oauth2-google                  4.0.1     Google OAuth 2.0 Client Provider for The PHP League OAuth2-Client
league/uri-parser                     1.4.1     userland URI parser RFC 3986 compliant
masterminds/html5                     2.8.1     An HTML5 parser and serializer.
monolog/monolog                       2.9.1     Sends your logs to files, sockets, inboxes, databases and various web services
mtdowling/jmespath.php                2.6.1     Declaratively specify how to extract elements from a JSON document
myclabs/deep-copy                     1.11.1    Create deep copies (clones) of your objects
nelmio/api-doc-bundle                 v4.11.1   Generates documentation for your REST API from annotations
nelmio/cors-bundle                    2.3.1     Adds CORS (Cross-Origin Resource Sharing) headers support in your Symfony application
netresearch/jsonmapper                v4.2.0    Map nested JSON structures onto PHP classes
nikic/php-parser                      v4.16.0   A PHP parser written in PHP
nyholm/psr7                           1.8.0     A fast PHP7 implementation of PSR-7
oneup/flysystem-bundle                4.8.0     Integrates Flysystem filesystem abstraction library to your Symfony project.
paragonie/random_compat               v9.99.100 PHP 5.x polyfill for random_bytes() and random_int() from PHP 7
phar-io/manifest                      2.0.3     Component for reading phar.io manifest information from a PHP Archive (PHAR)
phar-io/version                       3.2.1     Library for handling version information and constraints
php-http/client-common                2.7.0     Common HTTP Client implementations and tools for HTTPlug
php-http/curl-client                  2.3.0     PSR-18 and HTTPlug Async client with cURL
php-http/discovery                    1.19.1    Finds and installs PSR-7, PSR-17, PSR-18 and HTTPlug implementations
php-http/httplug                      2.4.0     HTTPlug, the HTTP client abstraction for PHP
php-http/message                      1.16.0    HTTP Message related tools
php-http/message-factory              1.1.0     Factory interfaces for PSR-7 HTTP Message
php-http/promise                      1.1.0     Promise used for asynchronous HTTP requests
phpdocumentor/reflection-common       2.2.0     Common reflection classes used by phpdocumentor to reflect the code structure
phpdocumentor/reflection-docblock     5.3.0     With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.
phpdocumentor/type-resolver           1.7.2     A PSR-5 based resolver of Class names, Types and Structural Element Names
phpstan/phpdoc-parser                 1.23.1    PHPDoc parser with support for nullable, intersection and generic types
phpstan/phpstan                       1.10.26   PHPStan - PHP Static Analysis Tool
phpunit/php-code-coverage             10.1.3    Library that provides collection, processing, and rendering functionality for PHP code coverage information.
phpunit/php-file-iterator             4.0.2     FilterIterator implementation that filters files based on a list of suffixes.
phpunit/php-invoker                   4.0.0     Invoke callables with a timeout
phpunit/php-text-template             3.0.0     Simple template engine.
phpunit/php-timer                     6.0.0     Utility class for timing
phpunit/phpunit                       10.3.1    The PHP Unit Testing framework.
psr/cache                             2.0.0     Common interface for caching libraries
psr/container                         1.1.2     Common Container Interface (PHP FIG PSR-11)
psr/event-dispatcher                  1.0.0     Standard interfaces for event handling.
psr/http-client                       1.0.2     Common interface for HTTP clients
psr/http-factory                      1.0.2     Common interfaces for PSR-7 HTTP message factories
psr/http-message                      1.1       Common interface for HTTP messages
psr/link                              1.1.1     Common interfaces for HTTP links
psr/log                               2.0.0     Common interface for logging libraries
psy/psysh                             v0.11.20  An interactive shell for modern PHP.
ralouphie/getallheaders               3.0.3     A polyfill for getallheaders.
sebastian/cli-parser                  2.0.0     Library for parsing CLI options
sebastian/code-unit                   2.0.0     Collection of value objects that represent the PHP code units
sebastian/code-unit-reverse-lookup    3.0.0     Looks up which function or method a line of code belongs to
sebastian/comparator                  5.0.0     Provides the functionality to compare PHP values for equality
sebastian/complexity                  3.0.0     Library for calculating the complexity of PHP code units
sebastian/diff                        5.0.3     Diff implementation
sebastian/environment                 6.0.1     Provides functionality to handle HHVM/PHP environments
sebastian/exporter                    5.0.0     Provides the functionality to export PHP variables for visualization
sebastian/global-state                6.0.1     Snapshotting of global state
sebastian/lines-of-code               2.0.0     Library for counting the lines of code in PHP source code
sebastian/object-enumerator           5.0.0     Traverses array structures and object graphs to enumerate all referenced objects
sebastian/object-reflector            3.0.0     Allows reflection of object attributes, including inherited and non-public ones
sebastian/recursion-context           5.0.0     Provides functionality to recursively process PHP variables
sebastian/type                        4.0.0     Collection of value objects that represent the types of the PHP type system
sebastian/version                     4.0.1     Library that helps with managing the version number of Git-hosted PHP projects
sentry/sdk                            3.5.0     This is a metapackage shipping sentry/sentry with a recommended HTTP client.
sentry/sentry                         3.21.0    A PHP SDK for Sentry (http://sentry.io)
sentry/sentry-symfony                 4.10.0    Symfony integration for Sentry (http://getsentry.com)
softcreatr/jsonpath                   0.8.2     JSONPath implementation for parsing, searching and flattening arrays
spatie/array-to-xml                   3.2.0     Convert an array to xml
squizlabs/php_codesniffer             3.7.2     PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.
stof/doctrine-extensions-bundle       v1.8.0    Integration of the gedmo/doctrine-extensions with Symfony
symfony/amazon-mailer                 v5.4.23   Symfony Amazon Mailer Bridge
symfony/amazon-sqs-messenger          v5.4.22   Symfony Amazon SQS extension Messenger Bridge
symfony/amqp-messenger                v5.4.22   Symfony AMQP extension Messenger Bridge
symfony/asset                         v5.4.21   Manages URL generation and versioning of web assets such as CSS stylesheets, JavaScript files and image files
symfony/browser-kit                   v5.4.21   Simulates the behavior of a web browser, allowing you to make requests, click on links and submit forms programmatically
symfony/cache                         v5.4.25   Provides extended PSR-6, PSR-16 (and tags) implementations
symfony/cache-contracts               v2.5.2    Generic abstractions related to caching
symfony/config                        v5.4.26   Helps you find, load, combine, autofill and validate configuration values of any kind
symfony/console                       v5.4.26   Eases the creation of beautiful and testable command line interfaces
symfony/css-selector                  v5.4.26   Converts CSS selectors to XPath expressions
symfony/dependency-injection          v5.4.26   Allows you to standardize and centralize the way objects are constructed in your application
symfony/deprecation-contracts         v3.3.0    A generic function and convention to trigger deprecation notices
symfony/doctrine-bridge               v5.4.26   Provides integration for Doctrine with various Symfony components
symfony/doctrine-messenger            v5.4.25   Symfony Doctrine Messenger Bridge
symfony/dom-crawler                   v5.4.25   Eases DOM navigation for HTML and XML documents
symfony/dotenv                        v5.4.22   Registers environment variables from a .env file
symfony/error-handler                 v5.4.26   Provides tools to manage errors and ease debugging PHP code
symfony/event-dispatcher              v5.4.26   Provides tools that allow your application components to communicate with each other by dispatching events and listening to them
symfony/event-dispatcher-contracts    v3.3.0    Generic abstractions related to dispatching event
symfony/expression-language           v5.4.21   Provides an engine that can compile and evaluate expressions
symfony/filesystem                    v5.4.25   Provides basic utilities for the filesystem
symfony/finder                        v5.4.27   Finds files and directories via an intuitive fluent interface
symfony/flex                          v2.3.3    Composer plugin for Symfony
symfony/form                          v5.4.26   Allows to easily create, process and reuse HTML forms
symfony/framework-bundle              v5.4.26   Provides a tight integration between Symfony components and the Symfony full-stack framework
symfony/http-client                   v5.4.26   Provides powerful methods to fetch HTTP resources synchronously or asynchronously
symfony/http-client-contracts         v2.5.2    Generic abstractions related to HTTP clients
symfony/http-foundation               v5.4.26   Defines an object-oriented layer for the HTTP specification
symfony/http-kernel                   v5.4.27   Provides a structured process for converting a Request into a Response
symfony/intl                          v5.4.26   Provides a PHP replacement layer for the C intl extension that includes additional data from the ICU library
symfony/lock                          v5.4.25   Creates and manages locks, a mechanism to provide exclusive access to a shared resource
symfony/mailer                        v5.4.22   Helps sending emails
symfony/maker-bundle                  v1.50.0   Symfony Maker helps you create empty commands, controllers, form classes, tests and more so you can forget about writing boilerplate code.
symfony/messenger                     v5.4.26   Helps applications send and receive messages to/from other applications or via message queues
symfony/mime                          v5.4.26   Allows manipulating MIME messages
symfony/monolog-bridge                v5.4.22   Provides integration for Monolog with various Symfony components
symfony/monolog-bundle                v3.8.0    Symfony MonologBundle
symfony/options-resolver              v5.4.21   Provides an improved replacement for the array_replace PHP function
symfony/password-hasher               v5.4.27   Provides password hashing utilities
symfony/polyfill-intl-grapheme        v1.27.0   Symfony polyfill for intl's grapheme_* functions
symfony/polyfill-intl-icu             v1.27.0   Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-intl-idn             v1.27.0   Symfony polyfill for intl's idn_to_ascii and idn_to_utf8 functions
symfony/polyfill-intl-normalizer      v1.27.0   Symfony polyfill for intl's Normalizer class and related functions
symfony/polyfill-mbstring             v1.27.0   Symfony polyfill for the Mbstring extension
symfony/polyfill-uuid                 v1.27.0   Symfony polyfill for uuid functions
symfony/process                       v5.4.26   Executes commands in sub-processes
symfony/property-access               v5.4.26   Provides functions to read and write from/to an object or array using a simple string notation
symfony/property-info                 v5.4.24   Extracts information about PHP class' properties using metadata of popular sources
symfony/proxy-manager-bridge          v5.4.21   Provides integration for ProxyManager with various Symfony components
symfony/psr-http-message-bridge       v2.3.1    PSR HTTP message bridge
symfony/redis-messenger               v5.4.26   Symfony Redis extension Messenger Bridge
symfony/routing                       v5.4.26   Maps an HTTP request to a set of configuration variables
symfony/runtime                       v5.4.26   Enables decoupling PHP applications from global state
symfony/security-bundle               v5.4.26   Provides a tight integration of the Security component into the Symfony full-stack framework
symfony/security-core                 v5.4.22   Symfony Security Component - Core Library
symfony/security-csrf                 v5.4.27   Symfony Security Component - CSRF Library
symfony/security-guard                v5.4.27   Symfony Security Component - Guard
symfony/security-http                 v5.4.26   Symfony Security Component - HTTP Integration
symfony/serializer                    v5.4.26   Handles serializing and deserializing data structures, including object graphs, into array structures or other formats like XML and JSON.
symfony/service-contracts             v2.5.2    Generic abstractions related to writing services
symfony/stopwatch                     v5.4.21   Provides a way to profile code
symfony/string                        v5.4.26   Provides an object-oriented API to strings and deals with bytes, UTF-8 code points and grapheme clusters in a unified way
symfony/translation                   v5.4.24   Provides tools to internationalize your application
symfony/translation-contracts         v2.5.2    Generic abstractions related to translation
symfony/twig-bridge                   v5.4.26   Provides integration for Twig with various Symfony components
symfony/twig-bundle                   v5.4.27   Provides a tight integration of Twig into the Symfony full-stack framework
symfony/uid                           v5.4.21   Provides an object-oriented API to generate and represent UIDs
symfony/validator                     v5.4.26   Provides tools to validate values
symfony/var-dumper                    v5.4.26   Provides mechanisms for walking through any arbitrary PHP variable
symfony/var-exporter                  v6.3.2    Allows exporting any serializable PHP data structure to plain PHP code
symfony/web-link                      v5.4.21   Manages links between resources
symfony/web-profiler-bundle           v5.4.26   Provides a development tool that gives detailed information about the execution of any request
symfony/workflow                      v5.4.27   Provides tools for managing a workflow or finite state machine
symfony/yaml                          v5.4.23   Loads and dumps YAML files
symfonycasts/reset-password-bundle    v1.17.0   Symfony bundle that adds password reset functionality.
symfonycasts/verify-email-bundle      v1.13.0   Simple, stylish Email Verification for Symfony
tgalopin/html-sanitizer               1.5.0     Sanitize untrustworthy HTML user input
theseer/tokenizer                     1.2.1     A small library for converting tokenized PHP source code into XML and potentially other formats
twig/extra-bundle                     v3.7.0    A Symfony bundle for extra Twig extensions
twig/intl-extra                       v3.7.0    A Twig extension for Intl
twig/twig                             v3.7.0    Twig, the flexible, fast, and secure template language for PHP
typesense/typesense-php               v4.8.3    PHP client for Typesense Search Server: https://github.com/typesense/typesense
vich/uploader-bundle                  1.23.1    Ease file uploads attached to entities
vimeo/psalm                           5.14.1    A static analysis tool for finding errors in PHP applications
webmozart/assert                      1.11.0    Assertions to validate method input/output with nice error messages.
willdurand/negotiation                3.1.0     Content Negotiation tools for PHP provided as a standalone library.
zircote/swagger-php                   4.7.11    swagger-php - Generate interactive documentation for your RESTful API using phpdoc annotations
  • Suite configuration:
actor: ApiTester
modules:
  enabled:
    - Asserts:
    - Symfony:
        app_path: 'src'
        environment: 'test'
    - REST:
        url: http://nginx
        depends: PhpBrowser
        part: Json
    - Db:
        dsn: 'pgsql:host=database;dbname=db1;port=5432'
        user: 'symfony'
        password: 'password'
        dump: tests/_data/dump/1_dumpfile.sql
        cleanup: true
        populate: true
        databases:
          db2:
            dsn: 'pgsql:host=database;dbname=db2;port=5432'
            user: 'symfony'
            password: 'password'
            dump: tests/_data/dump/2_dumpfile.sql
            cleanup: true
            populate: true
          db3:
            dsn: 'pgsql:host=database;dbname=db3;port=5432'
            user: 'symfony'
            password: 'password'
            dump: tests/_data/dump/3_dumpfile.sql
            cleanup: true
            populate: true
    - \App\Tests\Helper\Api
@Clasyc Clasyc changed the title Inconsistent Results between find and grabFromDatabase in Codeception 4 & 5 Inconsistent Results between find and grabFromDatabase Aug 5, 2023
@Clasyc
Copy link
Author

Clasyc commented Aug 5, 2023

For now I'm using a workaround to clear EntityManager after each test:

public function clearEntityManager(): void
{
    $this->getModule('Symfony')->kernel->getContainer()->get('doctrine')->getManager('db2')->clear();
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant