Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GlobalSet Element Fixture improvements #4947

Merged
merged 7 commits into from
Sep 23, 2019
Merged

GlobalSet Element Fixture improvements #4947

merged 7 commits into from
Sep 23, 2019

Conversation

boboldehampsink
Copy link
Contributor

Adds ability to specify whether to use AR or Element

@gtettelaar

Adds ability to specify whether to use AR or Element
@angrybrad
Copy link
Member

@boboldehampsink Thanks... probably should update the docs here, no? https://docs.craftcms.com/v3/testing/testing-craft/fixtures.html#global-set-fixture

@gtettelaar
Copy link
Contributor

gtettelaar commented Sep 17, 2019

@boboldehampsink I like this idea! This way we preserve the original functionality of your plugin.

I need to have a look at the implementation as I see 2 problems:

  • : void is being used which clashes with Craft's PHP 7 mininum requirement.
  • It looks like the code used in load() is copied from your own plugin which would mean it will not work with craft\test\fixtures\elements\ElementFixture (mainly because our class does not have a saveElement() or getErrors() method). In general I'm not a fan of having the GlobalSet class define it's own logic for saving an element as opposed to having that be handled by the main parent class.

I'll work on this tommorow and then it should be ready.

@angrybrad I'll also update the docs.

@gtettelaar gtettelaar self-requested a review September 17, 2019 18:34
@boboldehampsink
Copy link
Contributor Author

Yeah sorry, didn't test this yet as I just wanted to get the idea out there. Thanks for the help @gtettelaar

@gtettelaar
Copy link
Contributor

@boboldehampsink Do you have allow edits from maintainers enabled? I can't seem to push up to your branch.

@boboldehampsink
Copy link
Contributor Author

It is enabled!

@boboldehampsink
Copy link
Contributor Author

@gtettelaar did you get it to work?

@gtettelaar
Copy link
Contributor

@boboldehampsink Yea I got it sorted. Git Tower was being annoying on my end. I updated the code, can you check whether this was what you had in mind?

@gtettelaar gtettelaar added the testing ✅ features related to testing label Sep 20, 2019
@boboldehampsink
Copy link
Contributor Author

I tested this and it does what I want. Looks good to me!

Copy link
Contributor

@gtettelaar gtettelaar left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@angrybrad Good to go!

@angrybrad angrybrad merged commit 5f37912 into craftcms:develop Sep 23, 2019
@angrybrad
Copy link
Member

Looks good... merged! Thanks all.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
testing ✅ features related to testing
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants