Sign in

Software Developer, trying to learn more every day.

Today, I am happy to share with you guys with a practical example how to test the business logic of the Closures inside our methods, imagine that you have a method like the next one on your PHP Class:

public function delete(): Timestamp
$query = $this;
return $this->connection->runTransaction(function(Transaction $t) use($query) {
$t->executeUpdate($query->grammar->compileDelete($query), [
'parameters' => $query->getBindings()
return $t->commit();

Since we are running another object inside our closure, we will need to mock this one beyond the Connection class on the example, at least for the methods executeUpdate and commit, to do that we can follow the…

After doing a lot of research about these technologies, and having found no decent/fresh benchmark with Phalcon (PHP) against Express (Node.js), I decided to do it on my own. I was also curious to see how Lumen can compete against Phalcon, so I decided to add the “micro-framework” to the competition. The purpose of this benchmark is to simulate how these stacks can compete against each other when building a real application.

I am not a real fan of benchmarking, and I am sure that Phalcon, Lumen or Express will expectedly handle any application that you will ever need to…

miguel costa

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store