Rob Allen has a quick post to his site showing you how to test Slim actions using PHPUnit and some simple pieces of the Slim framework itself to set up the needed environment.
To test a Slim Framework action, you need a request and a response object and mock whatever is in the action. This is one way to do this.
He gives an example of a simple endpoint that just returns a JSON string. He shows the code for this endpoint and how it registers with the application for an
/echo route. He then gets in to the testing on the route's matching class, making an instance of the
Request class and an
Environment for it to work in. He ends the post by sharing teh code to pull all of these pieces together in a simple PHPUnit test that uses the
assertSame assertion to verify the JSON response output.