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

Provide a base class for subcontexts #141

Merged
merged 2 commits into from
Feb 13, 2015

Conversation

pfrenssen
Copy link
Collaborator

It would be helpful if we provide a base class for subcontexts.

  • Now all subcontexts have to implement the constructor but this is likely to be common for all subcontexts, causing code duplication.
  • We can extend RawDrupalContext which would be a sane default for the most common case of subcontexts provided by contributed modules.
  • If we have a base class we can also provide some helpful methods that can assist developers in building their subcontexts. As an example I have provided a method that allows the subcontext to get the currently logged in user from the DrupalContext class.

@jhedstrom
Copy link
Owner

This looks great!

Could you re-push this now that the module error has been fixed in the drupal driver?

(I wish there was a way to re-queue travis builds.)

@jhedstrom
Copy link
Owner

Oh, nevermind, Travis added a rebuild button!

jhedstrom added a commit that referenced this pull request Feb 13, 2015
Provide a base class for subcontexts
@jhedstrom jhedstrom merged commit 47a01bc into jhedstrom:master Feb 13, 2015
jhedstrom added a commit that referenced this pull request Feb 14, 2015
Provide a base class for subcontexts

Signed-off-by: Jonathan Hedstrom <jhedstrom@gmail.com>
@openprivacy
Copy link

So where I used to extend RawDrupalContext I should now extend DrupalSubContextBase as a general rule?

@jhedstrom
Copy link
Owner

If you're writing subcontexts you can extend this if you don't want to repeat all the boiler plate code it includes. For normal contexts, you can still extend RawDrupalContext.

@pfrenssen pfrenssen deleted the subcontextbase branch January 30, 2016 14:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants