Quantcast
Viewing all articles
Browse latest Browse all 293279

Entity API tests fail on SQLite

Steps to reproduce:

  • do a clean install using SQLite
  • enable the testing module
  • run the Entity API test group. It'll die with:
    ResponseText: A fatal error occurred: SQLSTATE[HY000]: General error: 1 table "entity_test_rev_revision" has more than one primary key: CREATE TABLE {entity_test_rev_revision} ( id INTEGER NOT NULL CHECK (id>= 0), revision_id INTEGER PRIMARY KEY AUTOINCREMENT CHECK (revision_id>= 0), langcode VARCHAR(12) NOT NULL DEFAULT '', name VARCHAR(32) NOT NULL DEFAULT '', user_id INTEGER NULL CHECK (user_id>= 0) DEFAULT NULL, PRIMARY KEY (id, langcode) );

The issue is that the serial field types get a "PRIMARY KEY" attached to them when converted to SQL. SQLite doesn't like getting two differently defined PRIMARY KEYs in a CREATE TABLE.

The RDF tests depend on Entity API's tests and thus also fail right now, which is how I ran into this. The RDF tests run cleanly on SQLite after applying the attached patch.

The attached patch elliminates the complex primary keys in the entity api test schemas which allows the tables to install on SQLite. The tests still run cleanly and not noticeably slower on MySQL after the change.

Unfortunately, afterward you run into an uncaught exception...

General error: 1 a GROUP BY clause is required before HAVING: SELECT COUNT(entity_test.id) AS id_count FROM {entity_test} base_table LEFT JOIN {entity_test} entity_test ON entity_test.id = base_table.id INNER JOIN {entity_test} entity_test_2 ON entity_test_2.id = base_table.id HAVING (COUNT(entity_test_2.id) = :db_placeholder_0) ; Array ( [:db_placeholder_0] => 8 )

..and a fatal error...
Cannot access protected property Drupal\field_test\Plugin\Core\Entity\TestEntity::$isDefaultRevision

...that prevent the tests from running successfully. At this point it is deep enough into core entity stuff that others are much more qualified to take it from here. I hope this helps though.
AttachmentSizeStatusTest resultOperations
drupal-entity_api_tests_fail_on_sqlite.patch920 bytesIgnored: Check issue status.NoneNone

Viewing all articles
Browse latest Browse all 293279

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>