liip / LiipTestFixturesBundle

This bundles enables efficient loading of Doctrine fixtures in functional test-cases for Symfony applications
https://liip.ch
MIT License
169 stars 45 forks source link

[Bug]: keep_database_and_schema config is ignored it is always false with SQL Server #235

Open FireOlex opened 1 year ago

FireOlex commented 1 year ago

Preconditions

-------------------- --------------------------------- 
  Symfony                                               
-------------------- --------------------------------- 
  Version              6.3.1                            
  Long-Term Support    No                               
  End of maintenance   01/2024 (in +195 days)           
  End of life          01/2024 (in +195 days)           
-------------------- --------------------------------- 
  Kernel                                                
-------------------- --------------------------------- 
  Type                 App\Kernel                       
  Environment          dev                              
  Debug                true                             
  Charset              UTF-8                            
  Cache directory      ./var/cache/dev (7.7 MiB)        
  Build directory      ./var/cache/dev (7.7 MiB)        
  Log directory        ./var/log (535 KiB)              
-------------------- --------------------------------- 
  PHP                                                   
-------------------- --------------------------------- 
  Version              8.2.7                            
  Architecture         64 bits                          
  Intl locale          n/a                              
  Timezone             UTC (2023-07-20T09:00:53+00:00)  
  OPcache              false                            
  APCu                 false                            
  Xdebug               false                            
-------------------- --------------------------------- 
  LiipTestFixturesBundle
-------------------- --------------------------------- 
  Version 2.6.0

Steps to reproduce

Creating config file for liip.

# config/packages/test/liip_fixtures.yaml
liip_test_fixtures:
  keep_database_and_schema: true

Expected result

When I run the debug command it should say true. And when I run my test the bundle should not try to create the table and schemas.

php bin/console debug:config LiipTestFixturesBundle keep_database_and_schema

Current configuration for "liip_test_fixtures.keep_database_and_schema"
=======================================================================

true

Actual result

When I run my test LiipTestFixtureBundle try always to create the Table and Schema and Ignores my config. I also run the command

php bin/console debug:config LiipTestFixturesBundle keep_database_and_schema

Current configuration for "liip_test_fixtures.keep_database_and_schema"
=======================================================================

false

Thes are my logs from the tests.

php -d memory_limit=4G vendor/bin/phpunit
-------------------- --------------------------------- 
Logs
-------------------- --------------------------------- 
PDOException: SQLSTATE[42000]: [Microsoft][ODBC Driver 18 for SQL Server][SQL Server]Object is invalid. Extended properties are not permitted on 'dbo.[user].roles', or the object does not exist.

/var/www/html/vendor/doctrine/dbal/src/Driver/PDO/Connection.php:32
/var/www/html/vendor/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php:46
/var/www/html/vendor/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php:46
/var/www/html/vendor/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php:46
/var/www/html/vendor/doctrine/dbal/src/Logging/Connection.php:50
/var/www/html/vendor/doctrine/dbal/src/Driver/Middleware/AbstractConnectionMiddleware.php:46
/var/www/html/vendor/symfony/doctrine-bridge/Middleware/Debug/Connection.php:74
/var/www/html/vendor/doctrine/dbal/src/Connection.php:1204
/var/www/html/vendor/doctrine/orm/lib/Doctrine/ORM/Tools/SchemaTool.php:106
/var/www/html/vendor/liip/test-fixtures-bundle/src/Services/DatabaseTools/ORMDatabaseTool.php:113
alexislefebvre commented 1 year ago

Thanks for the report.

Whaf if you set the test environment? Please share the output of this command:

php bin/console --env=test debug:config LiipTestFixturesBundle keep_database_and_schema

On a side note, the stack trace in this issue shows that it uses Doctrine but I don't know if this bundle is compatible with SQL server.

FireOlex commented 1 year ago

Thank you for your anwser. You are right with --env=test the output is correct. Yes I also believe that the bundle is not compatible with SQL server. I did not manage to get it work.