Waavi/translation

After integration -> Unittest fails: Foreign Constraint

Closed this issue · 3 comments

Hi,

After adding translation package the unit test for the recepient (my) project fails:
Illuminate\Database\QueryException : SQLSTATE[HY000]: General error: 1 foreign key mismatch - "translator_translations" referencing "translator_languages" (SQL: INSERT INTO translator_languages (id, locale, name, created_at, updated_at, deleted_at) SELECT id, locale, name, created_at, updated_at, deleted_at FROM __temp__translator_languages)

I am using in memory sqlite DB for unit tests:

In phpunit.xml:

With production DB (Postgres) -> every thing tests fine.

Commenting in /var/www/.../vendor/waavi/translation/database/migrations/2013_07_25_145958_create_translations_table.php -> line 25 with "foreign" -> resolves issue.

Please advise.

Thank you.

Kind regards,
TY

Same issue here, but I'm using an actual .sqlite file for unit testing

Looks like a dbal/laravel issue when working with sqlite:
laravel/framework#24876
Nothing inherently wrong with the module, this can probably be closed

I am facing the same issue.. The problem is, that the locale is not the primary key of the translator_languages table, whereby sqlite needs to reference primary keys. I also think that the locale should be the primary key for the langauges table.