-
Notifications
You must be signed in to change notification settings - Fork 20
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
Prevent re-creating session file on end #65
Prevent re-creating session file on end #65
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
feels like it might be better to perform that kind of checks outside this method so we keep it simple and its semantics reflect its name and concern
Thanks @dnsl48, yeah I wasn't totally happy with this. What do you think of splitting the |
Sounds like a plan. I guess we don't really have a choice right? :) |
it also feels weird that |
I was thinking |
well, I was rather thinking about moving out of it any modifications performed on the state, so it would only connect to the database preliminarily created outside. So it would only "apply" and not actually "modify" $state anyhow |
@blueo Do you agree with Serge, and can implement his suggestion? |
Hey @chillu i was looking into it but haven't quite managed to get all state change out. the biggest hurdle being that the test db name may change. But in general yes I agree and I'll be working on re-factoring it the next chance I get :) |
787ab03
to
92a4de4
Compare
Hi @dnsl48 :) So that turned into a bit of a rabbit hole. I've refactored to separate our given it is quite a big change I've added some unit tests to try cover some basic scenarios - i don't think this is exaustive atm. I'm using this refactor on an internal project so will be able to beef up the tests a bit as I go. cc @chillu |
wow, that definitely looks cool! I'll have a play with it some time this week. |
Hey @blueo, sorry for delay. I've run it, but it breaks otherwise green tests on my local setup.
I'll do some debugging later this week, but it seems like |
ah thanks @dnsl48 I'll have a look, i should probably add some basic behat checks |
92a4de4
to
0bdf049
Compare
Hey there, @dnsl48 yep, I missed creating the testsession. I also had a broken mailer setup, I've addressed both and added some test cases for it 👍 framework behat now runs green for me |
Nice! Do you mind resolving the conflict or rebasing the branch yet? |
0bdf049
to
b4a54a5
Compare
done :) |
I know that's not changed in the PR, but could we change it to
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's really good job!
Thank you for doing those tough refactoring bits and untying this knot!
Let's think if we could spare backwards compatibility or otherwise we could think on moving this changes to master (and potentially the next major version of the module).
4ce5506
to
2eee104
Compare
2eee104
to
0eb7fa4
Compare
0eb7fa4
to
a3f7b51
Compare
Here's the fix for TestMailer - silverstripe/silverstripe-behat-extension#188 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
good work 👍
P.S.
Tested locally on ss/installer (@framework and @cms). Though, also requires silverstripe/silverstripe-behat-extension#188
`appyState` will now only read the test session data and update the environment to relect that state. This is intended for things like database connections and mailer classes. Actions that need to alter state to apply it (eg creating a temp db) should be done in other actions such as 'start' `saveState` will only take an existing state object and persist it to a file Also addresses: [Connect to test database on session load](silverstripe#63) [Skip Temp DB creation if state has no database prop](silverstripe#64) Prevent re-creating session file on end (original issue for this PR)
a3f7b51
to
1d8f112
Compare
Good to merge when silverstripe/silverstripe-behat-extension#188 is merged |
@dnsl48 it feels like we might be able to merge/tag this before silverstripe/silverstripe-behat-extension#188 ? I'd be interested in doing a little more work on this module around assets etc but I'm worried this will become the never-ending-pr if I do... |
Sorry, no can do, without 188 it breaks email related tests. On the other hand, I'm quite certain this PR will be merged "as is", so if you base your other PRs on top of this one, you most likely won't even need to rebase |
but if this is a new major version - you don't need to use it until you want right? So the email related tests would still use the older version? |
That's right. I think you're right. We can deal with behat-extension separately. |
cool thanks! |
saveState
will re-create a session file after the test session has ended. This adds a condition to check if the test session has been cleared before writing the file.