Unit Testing Javascript Code Inlined Within PHP -
at work i've been tasked unit testing our javascript code. settled upon jasmine unit testing framework , began learn how use when informed inline our javascript code within php , not using javascript files longer.
can jasmine work around this? there framework could? should using php unit test , javascript unit test? best approach?
some example code basic page give idea:
http://pastebin.com/qar8zuh1 <---submit
any sort of insight appreciated
best practice split php out of javascript , unit test each separately. in long run, becomes nightmare maintain , test heavily integrated code. try modularize as possible.
for example, here's how it:
var examplevariables = { 'name' = <?=$name?>, 'occupation' = <?=$occupation?> }; unittestablefunction(examplevariables);
Comments
Post a Comment