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

Errors when running unit tests #2011

Open
pli888 opened this issue Aug 19, 2024 · 0 comments
Open

Errors when running unit tests #2011

pli888 opened this issue Aug 19, 2024 · 0 comments

Comments

@pli888
Copy link
Member

pli888 commented Aug 19, 2024

There are sometimes error messages when running unit tests in the dev environment which were observed when reviewing PR #1987.

To reproduce the problem:

  1. Run ./up.sh to start dev GigaDB instance.
  2. Run RelationDAOTest unit test:
docker-compose run --rm test ./vendor/codeception/codeception/codecept run unit RelationDAOTest
1) RelationDAOTest: Itshould add reciprocal relation | #0
 Test  tests/unit/RelationDAOTest.php:testItshouldAddReciprocalRelation
                                                                           
  [PHPUnit_Framework_Exception] Trying to get property 'id' of non-object  
                                                                           
#1  /var/www/protected/models/RelationDAO.php:64
#2  /var/www/tests/unit/RelationDAOTest.php:65
#3  RelationDAOTest->testItshouldAddReciprocalRelation

However, running all unit tests by executing docker-compose run --rm test ./vendor/codeception/codeception/codecept run unit will allow RelationDAOTest to pass. If you then run docker-compose run --rm test ./vendor/codeception/codeception/codecept run unit RelationDAOTest then this will pass too.

Feels like running docker-compose run --rm test ./vendor/codeception/codeception/codecept run unit makes docker-compose run --rm test ./vendor/codeception/codeception/codecept run unit RelationDAOTest use test data in protected/tests/fixtures. If you execute docker-compose run --rm test ./vendor/codeception/codeception/codecept run unit RelationDAOTest immediately after ./up.sh then dev data is used in unit tests which may be related to why it was sometimes failing for me.

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

No branches or pull requests

2 participants