Bug #35007

Functional tests do not work with MySQL database

Added by Christopher Hlubek over 3 years ago. Updated over 3 years ago.

Status:Resolved Start date:2012-03-19
Priority:Must have Due date:
Assigned To:Karsten Dambekalns % Done:

100%

Category:- Testing -
Target version:TYPO3 Flow Base Distribution - 1.1
PHP Version: Complexity:
Has patch:No Affected Flow version:Git master

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

Associated revisions

Revision 019507ae
Added by Karsten Dambekalns over 3 years ago

[BUGFIX] Use lowercase table names to fix functional tests

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

This change adjusts some Table annotations used in functional
test fixtures to use lowercase identifier.

Change-Id: I9a73567437864d322210858dc6d0a4736553221a
Fixes: #35007
Releases: 1.1

History

#1 Updated by Karsten Dambekalns over 3 years ago

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

I'll check this.

#2 Updated by Karsten Dambekalns over 3 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 over 3 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 over 3 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 over 3 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 over 3 years ago

  • Status changed from Needs Feedback to Accepted

Ok.

#7 Updated by Gerrit Code Review over 3 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 over 3 years ago

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

Also available in: Atom PDF