unit-testingsymfonytestingbehat

After running the behat testing, It turns my new migration to old version


I have a new migration file that has new column. I have migrated it for both my main and test databases as below

docker exec -it statisticsweb php bin/console doctrine:migrations:migrate
docker exec -it statisticsweb php bin/console doctrine:migrations:migrate --env=test

My test table seems like below

enter image description here

I am running my feature testing

enter image description here

I am running behat test as below:

docker exec -it statisticsweb vendor/behat/behat/bin/behat features/features/Report/master_game_report.feature:8

It returns an error as below

 When I execute sql "INSERT INTO master_game_report (date, domain_id, game_id, currency, total_bet_amount, total_bet_count, total_win_amount, total_win_count, real_bet_amount, real_win_amount, bonus_bet_amount, bonus_win_amount) VALUES ('2021-11-18 00:00:00', 1, 1, 'EUR')" 
 # TestUtilities\Context\DatabaseContext::executeQuery()
 An exception occurred while executing 'INSERT INTO master_game_report (date, domain_id, game_id, currency) VALUES ('2021-11-18 00:00:00', 1, 1, 'EUR')':
SQLSTATE[42S22]: Column not found: 1054 Unknown column 'currency' in 'field list' (Doctrine\DBAL\Exception\InvalidFieldNameException)
    │
    ╳  Fatal error: Call to a member function getValue() on null (Behat\Testwork\Call\Exception\FatalThrowableError)
    │
    └─ @AfterStep 

I am looking at my test table and it seems below so the currency column has disappeared

enter image description here

I am running

docker exec -it statisticsweb php bin/console doctrine:migrations:migrate --env=test

// It returns No migrations to execute.

My behat.yml file is

enter image description here

Why are the changes I made in my table being undone?


Solution

  • It worked fine after deleting the cache files.

    rm -rf ./var/cache/*