← Back to team overview

mahara-contributors team mailing list archive

[Bug 1810427] Re: Bug in unit tests with constraints in mysql

 

** Changed in: mahara
       Status: Fix Committed => Fix Released

-- 
You received this bug notification because you are a member of Mahara
Contributors, which is subscribed to Mahara.
Matching subscriptions: Subscription for all Mahara Contributors -- please ask on #mahara-dev or mahara.org forum before editing or unsubscribing it!
https://bugs.launchpad.net/bugs/1810427

Title:
  Bug in unit tests with constraints in mysql

Status in Mahara:
  Fix Released

Bug description:
  Mahara version : 18.10
  Database : MySQL

  The unit tests fail to execute when using MySQL, because of an sql
  error due to constraints ("DROP CONSTRAINT" is not supported in
  MySQL).

  In htdocs/testing/classes/util.php, I think that the following line 
  execute_sql('ALTER TABLE {lti_assessment} DROP CONSTRAINT {ltiasse_oau_fk}');

  should be replaced by 
  if (is_mysql()) {
      execute_sql('ALTER TABLE {lti_assessment} DROP FOREIGN KEY {ltiasse_oau_fk}');
  } 
  else {
      execute_sql('ALTER TABLE {lti_assessment} DROP CONSTRAINT {ltiasse_oau_fk}');
  }

  and 
  execute_sql('ALTER TABLE {collection} DROP CONSTRAINT {coll_fra_fk}');

  should be 
  if (is_mysql()) {
      execute_sql('ALTER TABLE {collection} DROP FOREIGN KEY {coll_fra_fk}');
  } 
  else {
      execute_sql('ALTER TABLE {collection} DROP CONSTRAINT {coll_fra_fk}');
  }

  The same logic is already used in the same file for other contraints.
  Maybe some indexes should be dropped also, not only the foreign key.

To manage notifications about this bug go to:
https://bugs.launchpad.net/mahara/+bug/1810427/+subscriptions


References