Bug #35007

Functional tests do not work with MySQL database

Added by Christopher Hlubek over 9 years ago. Updated about 9 years ago.

Status:
Resolved
Priority:
Must have
Category:
- Testing -
Start date:
2012-03-19
Due date:
% Done:

100%

Estimated time:
PHP Version:
Has patch:
No
Complexity:

Description

If persistence is enabled in functional tests and a MySQL database is configured, I get the following error when executing the test on a clean database:

1) Planetflow3\Tests\Functional\Controller\StandardControllerTest::indexActionWithoutParametersDisplaysRecentItems
PDOException: SQLSTATE[42S01]: Base table or view already exists: 1050 Table 'persistence_testentity' already exists

/Volumes/Data/Work/FLOW3/Planetflow3/Packages/Framework/Doctrine.DBAL/Classes/Connection.php:633
/Volumes/Data/Work/FLOW3/Planetflow3/Packages/Framework/Doctrine.ORM/Classes/Tools/SchemaTool.php:671
/Volumes/Data/Work/FLOW3/Planetflow3/Data/Temporary/Testing/Cache/Code/FLOW3_Object_Classes/TYPO3_FLOW3_Persistence_Doctrine_PersistenceManager_Original.php:271
/Volumes/Data/Work/FLOW3/Planetflow3/Packages/Framework/TYPO3.FLOW3/Tests/FunctionalTestCase.php:119
/Volumes/Data/Work/FLOW3/Planetflow3/Packages/Application/Planetflow3/Tests/Functional/Controller/StandardControllerTest.php:38
/Volumes/Data/Work/FLOW3/Planetflow3/Packages/Framework/TYPO3.FLOW3/Tests/BaseTestCase.php:49
#1

Updated by Karsten Dambekalns over 9 years ago

  • Category set to - Testing -
  • Status changed from New to Accepted
  • Assignee set to Karsten Dambekalns
  • Target version set to 1.1

I'll check this.

#2

Updated by Karsten Dambekalns over 9 years ago

  • Status changed from Accepted to Needs Feedback

Works for me using a Phoenix setup. Are you sure in your test setup/teardown are called?

#3

Updated by Christopher Hlubek about 9 years ago

This seems to be a problem with MySQL and lower / uppercase table names (maybe only on case insensitive filesystems).

We have to make sure that table names are handled consistently. When creating tables, they are spelled mixed-case (depending on table option). On tearDown the tables are dropped with lowercase.

#4

Updated by Karsten Dambekalns about 9 years ago

I remember we talked about that during T3DD12 - i'll change the table annotation in the fixture and submit a change (or could you do that)?

That would be more of a hotfix - since setup and teardown just use Doctrine Schema tools, it should work the same in both ways, no? Doctrine bug?

#5

Updated by Christopher Hlubek about 9 years ago

I tried to fix that, but it didn't work either (maybe my test database was already "corrupted"). I upgraded from MySQL 5.1.46 to 5.1.61 (Mac Ports) and don't get the problem anymore. But I still think that the annotation should be lowercase for consistency.

#6

Updated by Karsten Dambekalns about 9 years ago

  • Status changed from Needs Feedback to Accepted

Ok.

#7

Updated by Gerrit Code Review about 9 years ago

  • Status changed from Accepted to Under Review

Patch set 1 for branch master has been pushed to the review server.
It is available at http://review.typo3.org/10885

#8

Updated by Karsten Dambekalns about 9 years ago

  • Status changed from Under Review to Resolved
  • % Done changed from 0 to 100

Also available in: Atom PDF