How i can write an unit test, for my Task (sfBaseTask) ?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
If you’re asking how to write a unit test for a task than firstly you need to initialize configuration:
Later, as tasks are just classes, you can easily initialize them and test:
However, I think it’s better to put task logic into separate class(es) and use them in task’s execute() method. It’s even easier to test this way.