You will need node & npm for the full demo. You only need a browser to execute the tests but for full reporting/file watching features you need the server.
Tested for node 0.4.9, ~0.6
You will need my branch:
| PSI.Validator = function(){ | |
| this.init.apply(this, arguments); | |
| }; | |
| PSI.Validators.Presence = function(){ | |
| this.init.apply(this, arguments); | |
| }; | |
| PSI.Validators.Presence = YAHOO.lang.augmentObject({ |
| <?php | |
| /** | |
| This is what I had in mind while thinking about a spec framework for PHP. | |
| It is more verbose then other languages but its all PHP and should be easy enough to augment. | |
| I admit I wrote this without any thought to compatibility with anything else. | |
| */ | |
| //Contexts (befores, afters and shoulds are executed within a context). |
| SlowDescribeReporter.prototype = { | |
| threshold: 400, | |
| reportRunnerStarting: function(runner){ | |
| var i, len, suites = runner.suites_, self = this; | |
| this.topLevels = {}; | |
| for(i = 0, len = suites.length; i < len; i++){ | |
| (function(exec){ |
| var SubjectClass = require('subject-class'); | |
| describe("NewLets", function(){ | |
| var subject; | |
| stage('subject', function(){ | |
| subject = new SubjectClass; | |
| }); | |
| 127.0.0.1 gaiamobile.org | |
| 127.0.0.1 homescreen.gaiamobile.org | |
| 127.0.0.1 dialer.gaiamobile.org | |
| 127.0.0.1 sms.gaiamobile.org | |
| 127.0.0.1 browser.gaiamobile.org | |
| 127.0.0.1 maps.gaiamobile.org | |
| 127.0.0.1 camera.gaiamobile.org | |
| 127.0.0.1 gallery.gaiamobile.org | |
| 127.0.0.1 video.gaiamobile.org | |
| 127.0.0.1 market.gaiamobile.org |
| backend.send({ | |
| type: 'newSession', | |
| to: 'connection1' | |
| }, function(err, data){ | |
| //err for connection issues not errors sent by the server | |
| //data is the json response. | |
| }); |
| /** | |
| * Make an XHR request accepts the following options | |
| * | |
| * method: (String) GET, POST, etc.. | |
| * url: (String) http://... | |
| * async: (Boolean) | |
| * success: (Callback) fired on success (get xhr object) | |
| * error: (Callback) fired on error (get xhr object) | |
| * complete: (Callback) fired on both error and success (gets xhr object) | |
| * headers: (Object) list of headers |
| const CC = Components.Constructor; | |
| const LocalFile = CC('@mozilla.org/file/local;1', | |
| 'nsILocalFile', | |
| 'initWithPath'); | |
| const ScriptableInputStream = CC( | |
| "@mozilla.org/scriptableinputstream;1", | |
| "nsIScriptableInputStream"); | |
| Components.utils.import('resource:///modules/devtools/dbg-client.jsm'); |
| suite('myclass', function test(){ | |
| test('#myMethod', function someName(){ | |
| //... | |
| }); | |
| }); |