pkp / ots

PKP XML Parsing Service
GNU General Public License v3.0
32 stars 19 forks source link

JobControllerTest fails on cleanup #4

Closed crism closed 9 years ago

crism commented 9 years ago
There was 1 error:

1) ApiTest\Controller\ApiControllerTest::testSubmitActionCannotBeAccessedLoggedOut
Doctrine\DBAL\Exception\ForeignKeyConstraintViolationException: An exception occurred while executing 'DELETE FROM user WHERE id = ?' with params [74]:

SQLSTATE[23000]: Integrity constraint violation: 1451 Cannot delete or update a parent row: a foreign key constraint fails (`xmlps`.`job`, CONSTRAINT `FK_FBD8E0F864B64DCC` FOREIGN KEY (`userId`) REFERENCES `user` (`id`))

It looks like createTestData() makes a user and a job, but cleanTestData() then attempts to delete the user, but not the job linked to the user.

crism commented 9 years ago

Actually, the user is linked to by a job, which is in turn linked to by a document, so those three things must be deleted in that (reverse) order.

crism commented 9 years ago

Code review requested.

asmecher commented 9 years ago

@crism, I don't know this codebase, but at a glance this looks good. @axfelix, mind taking a peek?

axfelix commented 9 years ago

Looks good! I like the nested deletion like we discussed on slack, and emails are unique identifiers in the DB, so everything makes sense to me. Commenting certainly meets my standards too, though my commenting standards are very low :) Excellent first real commit. Thanks.

crism commented 9 years ago

I think that fixes it; merging into dev/install-notes, but we’re not out of the woods yet!