 | News Feed |
 | Jobs Feed |
Sections
|
| feed this: |  |
Maarten Balliauw: Running unit tests when deploying to Windows Azure Web Sites
by Chris Cornutt January 30, 2013 @ 10:25:20
Maarten Balliauw has a new post to his site showing you how to execute your unit tests (in this case PHPUnit) when you deploy your instance out to the Windows Azure platform.
When deploying an application to Windows Azure Web Sites, a number of deployment steps are executed. For .NET projects, msbuild is triggered. For node.js applications, a list of dependencies is restored. For PHP applications, files are copied from source control to the actual web root which is served publicly. Wouldn't it be cool if Windows Azure Web Sites refused to deploy fresh source code whenever unit tests fail? In this post, I'll show you how.
He creates a super basic script using Silex and writes up a test with some dummy assertions, checking if true equals true. He then steps you through updating the current "deploy.sh" script to add in a call to execute PHPUnit and an "exitWithMessageOnError" statement. This statement kicks it back and causes the deployment to fail when tests don't pass (as seen here).
voice your opinion now!
windows azure phpunit unittest execute deploy fail
NetTuts.com: Automatic Testing for TDD with PHP
by Chris Cornutt August 24, 2012 @ 09:09:04
If you practice the TDD (test-driven development) methodology in your work, you know that sometimes switching back and forth between a terminal and your IDE can be distracting. In this new tutorial from NetTuts.com, they show you how to streamline things a bit with a simple Ruby script.
Traditional test-driven development can, at times, be cumbersome. You have to stop writing code in order to run your tests. Luckily, there are solutions, which provide the ability to automatically run your tests as you code. In this tutorial, you will learn how to use a Ruby gem, called watchr, to monitor your code and automatically run the appropriate tests whenever you save your work.
The IDE doesn't matter in this case because the "watchr" tool keeps an eye on when things change in the watched directory and automatically fires off a script when it sees an update. They include the few short lines of Ruby to make it all happen and even have the "notify-send" command built in to give you a popup about the pass/fail status.
voice your opinion now!
automatic testing tdd ruby watchr popup execute
Gonzalo Ayuso's Blog: How to use eval() without using eval() in PHP
by Chris Cornutt March 13, 2012 @ 10:09:52
In this new post Gonzalo Ayuso talks about "using eval without using eval" in PHP applications - executing PHP code without having to use the eval function to do it.
Yes I know. Eval() is evil. If our answer is to use eval() function, we are probably asking the wrong question. When we see an eval() function all our coding smell's red lights start flashing inside our mind. Definitely it's a bad practice. But last week I was thinking about it. How can I eval raw PHP code without using the eval function, and I will show you my outcomes.
He includes some sample code showing a basic script with a class and a loop executing normally, then an "eval version" that puts it all in a string and executes it. He offers a different method - not an ideal one since it requires being able to write to the local file system, but prevents the need for eval - writing the PHP code to a temporary file and using a "fake eval" to pull it in.
voice your opinion now!
eval execute string code temporary file include
DZone.com: Running JavaScript inside PHP code
by Chris Cornutt March 01, 2012 @ 09:56:45
On DZone.com Giorgio Sironi has a new post about an interesting new PHP extension that lets you run javascript inside PHP - v8js (VERY alpha right now).
v8js is a new PHP extension able to run JavaScript code inside V8, Google's JavaScript interpreter that powers for example Chrome and NodeJS. This extension is highly alpha - and its API would probably change in the months ahead. Since documentation is lacking, I invite you to repeat the discovering process I follow in this post in case you find some differences in a new version of v8js.
He gives you the (PECL-based) commands to get the extension and it's needed dependencies installed and enabled. He uses PHP's own Reflection features to look at the extension and find its methods including: "executeString", "getPendingException" and "getExtensions".
To show it in action, he implements an old standby to test new languages - the FizzBuzz example - in Javascript, executed inside the PHP. He also includes a quick example of how to load in an external Javascript file and execute the results.
voice your opinion now!
javascript extension execute v8js google interpreter
Davey Shafik's Blog: Avoiding EVAL()
by Chris Cornutt February 02, 2009 @ 11:15:24
Davey Shafik has a helpful hint for avoiding one of the worst functions to use in PHP - eval.
There are a shed-load of ways to "eval()" code without actually calling the eval() function '" usually done simply to avoid the use of the dreaded "evil()" function, but often times because the system has eval() disabled using "disable_functions" in php.ini. Here is another simple way to avoid eval() without writing out files to the filesystem
His example uses the streams wrapper to natively execute the code from a string variable as a data element, base64 decoded. It's more of a proof-of-concept than anything else, but its an interesting solution to a tough problem to solve at times.
voice your opinion now!
eval evil avoid streams wrapper data base64 execute
|
Community Events
Don't see your event here? Let us know!
|