Date post: | 10-May-2015 |
Category: |
Technology |
Upload: | phase2 |
View: | 2,648 times |
Download: | 4 times |
OO and TDD in SPS is cool
by Erik Summerfield Phase2 Technology [email protected] e2thex most other places
What is SPS?
The Site Preview System developed as part of the Content Staging Initative, fund by a Aquia's Large Scale Drupal Project
What is TDD?
.------------. .-------| edit Test | | '------------' v ^ .------------. .----------. | | write Test |---->| run Test |--Pass---' '------------' '----------' .------------. | .------| Edit Code | Fails | '------------' v v ^ .------------. .----------. | | write code |----->| run Test |--Fails-' '------------' '----------' | Pass v .---------------. | refactor code | '---------------'
✩ Refactoring is so nice✩ Collaboration was smooth✩ Early Detection of Design Flaws
Doing TDD in Drupal
Unit vs Web
Tell Drupal about your tests
Base Class
Example at http://drupalcode.org/project/sps.git/blob/refs/heads/7.x-1.x:/tests/SPSBase.test
Writing Tests
Example at http://drupalcode.org/project/sps.git/blob/refs/heads/7.x-1.x:/tests/SPSDrupalUnit.test
Running Tests
✩ php scripts/run-tests.sh --color GROUPNAME [output of command]✩ php scripts/run-tests.sh --verbose --color --class CLASSNAME[output of command]
Why OO for SPS?
✩-SPS was a relatively comlicated system✩ Need to allow for extendablity✩ We could! (php 5.3)
Plugins
Plugins Class Interfaces
Fighting Drupal
Workaround hooks
Workaround for Forms
Questions?