Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

3,040 views

Published on

These are the slides Erik Summerfield (e2thex) presented at DrupalCamp Austin 2013. During his talk, he explored the benefits of Test Driven Development (TDD) that he saw in writing the SPS module and how an Object Oriented (OO) approach helped make this process work. In addition, he discussed the challenges of doing TDD in Drupal and how to work through the using OO ideas.

Published in: Technology
0 Comments
1 Like
Statistics
Notes
  • Be the first to comment

No Downloads
Views
Total views
3,040
On SlideShare
0
From Embeds
0
Number of Embeds
1,113
Actions
Shares
0
Downloads
1
Comments
0
Likes
1
Embeds 0
No embeds

No notes for slide

Test Drive Development and Objet Oriented in SPS: A Case Study in fighting Drupal

  1. 1. OO and TDD in SPS is cool
  2. 2. by Erik SummerfieldPhase2 Technologyesummerfield@phase2technology.come2thex most other places
  3. 3. What is SPS?
  4. 4. The Site Preview System developedas part of the Content Staging Initative,fund by a Aquias Large Scale Drupal Project
  5. 5. What is TDD?
  6. 6. .------------..-------| edit Test || ------------v ^.------------. .----------. || write Test |---->| run Test |--Pass--------------- ---------- .------------.| .------| Edit Code |Fails | ------------v v ^.------------. .----------. || write code |----->| run Test |--Fails------------- ----------|Passv.---------------.| refactor code |---------------
  7. 7. ✩ Refactoring is so nice✩ Collaboration was smooth✩ Early Detection of Design Flaws
  8. 8. Doing TDD in Drupal
  9. 9. Unit vs Web
  10. 10. Tell Drupal about your tests
  11. 11. Base Class
  12. 12. Example at http://drupalcode.org/project/sps.git/blob/refs/heads/7.x-1.x:/tests/SPSBase.test
  13. 13. Writing Tests
  14. 14. Example at http://drupalcode.org/project/sps.git/blob/refs/heads/7.x-1.x:/tests/SPSDrupalUnit.test
  15. 15. Running Tests
  16. 16. ✩ php scripts/run-tests.sh --color GROUPNAME[output of command]✩ php scripts/run-tests.sh --verbose --color --class CLASSNAME[output of command]
  17. 17. Why OO for SPS?
  18. 18. ✩-SPS was a relatively comlicated system✩ Need to allow for extendablity✩ We could! (php 5.3)
  19. 19. Plugins
  20. 20. Plugins Class Interfaces
  21. 21. Fighting Drupal
  22. 22. Workaround hooks
  23. 23. Workaround for Forms
  24. 24. Questions?

×