Laravel changes for Codeception 2.2 #2866

Merged
merged 5 commits into from Mar 2, 2016

Conversation

Projects
None yet
2 participants
@janhenkgerritsen
Contributor

janhenkgerritsen commented Mar 2, 2016

  • Removed the Laravel 4 module, because Laravel 4 depends on versions of Symfony components that will not be supported in Codeception 2.2.
  • Refactored database methods for the Laravel5 and Lumen modules:
    • Removed the createModel method from the Laravel5 module, it was just an alias of the haveModel method.
    • Removed the makeModel method from the Laravel5 module, as it is not really needed for functional tests.
    • Renamed the haveModel method of the Laravel5 module to have to make it consistent with the API of the DataFactory module.
    • Created a haveMultiple method to create more than one model per call, also for consistency with the DataFactory module.
    • The haveRecord, seeRecord, dontSeeRecord and grabRecord methods of the Laravel5 and Lumen modules now also accept class names of Eloquent models as the first parameter, instead of only database table names.

janhenkgerritsen added a commit that referenced this pull request Mar 2, 2016

Merge pull request #2866 from janhenkgerritsen/master
Laravel changes for Codeception 2.2

@janhenkgerritsen janhenkgerritsen merged commit a31047e into Codeception:master Mar 2, 2016

3 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
semaphoreci The build passed on Semaphore.
Details
@torkiljohnsen

This comment has been minimized.

Show comment
Hide comment
@torkiljohnsen

torkiljohnsen Jun 10, 2016

Contributor

Ok. So this just broke my test suite, bigtime :) Some migration instructions would have been awesome. This should also be listed as breaking changes in the Codeception 2.2 release log. Right now I only see mentioned that the Laravel4 module was removed.

Contributor

torkiljohnsen commented Jun 10, 2016

Ok. So this just broke my test suite, bigtime :) Some migration instructions would have been awesome. This should also be listed as breaking changes in the Codeception 2.2 release log. Right now I only see mentioned that the Laravel4 module was removed.

@janhenkgerritsen

This comment has been minimized.

Show comment
Hide comment
@janhenkgerritsen

janhenkgerritsen Jun 15, 2016

Contributor

@torkiljohnsen You are right, these changes should have been mentioned in the changelog. I have added the changes to the changelog with #3226.

Thanks for reporting the issue!

Contributor

janhenkgerritsen commented Jun 15, 2016

@torkiljohnsen You are right, these changes should have been mentioned in the changelog. I have added the changes to the changelog with #3226.

Thanks for reporting the issue!

@torkiljohnsen

This comment has been minimized.

Show comment
Hide comment
@torkiljohnsen

torkiljohnsen Jun 21, 2016

Contributor

Should note that grabRecord used to return an object but now it returns an array if you use it with table_name string. Previously I did this:

$item = $i->grabRecord('table_name', ['foo' => 'bar']);
$item->whatever;

This doesn't work anymore. Had to change table_name to ModelName::class in all grabRecord calls to migrate to 2.2.

Contributor

torkiljohnsen commented Jun 21, 2016

Should note that grabRecord used to return an object but now it returns an array if you use it with table_name string. Previously I did this:

$item = $i->grabRecord('table_name', ['foo' => 'bar']);
$item->whatever;

This doesn't work anymore. Had to change table_name to ModelName::class in all grabRecord calls to migrate to 2.2.

@janhenkgerritsen

This comment has been minimized.

Show comment
Hide comment
@janhenkgerritsen

janhenkgerritsen Jun 23, 2016

Contributor

Ah you are right, that is due to the changes in commit 1cc05fc.

In that commit I added a cast to array before returning the result in the internal findRecord method. To be honest I can't recall why I added this cast, it probably is a mistake.

Contributor

janhenkgerritsen commented Jun 23, 2016

Ah you are right, that is due to the changes in commit 1cc05fc.

In that commit I added a cast to array before returning the result in the internal findRecord method. To be honest I can't recall why I added this cast, it probably is a mistake.

@torkiljohnsen

This comment has been minimized.

Show comment
Hide comment
@torkiljohnsen

torkiljohnsen Jun 23, 2016

Contributor

I don't mind change, don't get me wrong, but it wasn't documented as a
breaking change so it threw us off guard here for a minute :)

On Thu, 23 Jun 2016 at 14:01 Jan-Henk Gerritsen notifications@github.com
wrote:

Ah you are right, that is due to the changes in commit 1cc05fc
1cc05fc
.

In that commit I added a cast to array before returning the result in the
internal findRecord method. To be honest I can't recall why I added this
cast, it probably is a mistake.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2866 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AATaiXUU7NjbvuzVurWSFjLRvn3iNAYPks5qOnWYgaJpZM4HnTqE
.

Contributor

torkiljohnsen commented Jun 23, 2016

I don't mind change, don't get me wrong, but it wasn't documented as a
breaking change so it threw us off guard here for a minute :)

On Thu, 23 Jun 2016 at 14:01 Jan-Henk Gerritsen notifications@github.com
wrote:

Ah you are right, that is due to the changes in commit 1cc05fc
1cc05fc
.

In that commit I added a cast to array before returning the result in the
internal findRecord method. To be honest I can't recall why I added this
cast, it probably is a mistake.


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#2866 (comment),
or mute the thread
https://github.com/notifications/unsubscribe/AATaiXUU7NjbvuzVurWSFjLRvn3iNAYPks5qOnWYgaJpZM4HnTqE
.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment