1

Is there a way in the testing framework to define a generic form intended only when tests run?

I have created some custom form item Element classes. I have working Unit tests with them, but I would also like to provide Simpletests for them as well.

1 Answer 1

2

Core provides several examples of this. The basic pattern is to create a test module, and have that module provide the form. In your test ::setUp(), you add the test module to $modules, and then your form should be available for use.

Look through 'core/*/tests/modules' for the test modules, and if you have an IDE that class completes, a lot of the test form are (wait for it) TestForm.

However, in your case, I would look at existing Element classes and see what their integration tests look like. I suspect you can just emulate what they are doing w/o needing your own test module.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.