LombaXMonday N° 3 – links and resources from the IT World

What is this? Every day I read a lot of articles about computer programming and languages, infrastructures, new technologies, quick tips, trends, architectures and so on. I read them immediately or put in my “read later” list. All my readings helped me to grow and learn new things…so why don’t share them with my readers? For this reason, I decided to publish and share, every monday, a list of the links I came accross during the past days.


Check the technology behind a website. Is it WordPress? Is it Joomla? - link

Do you want to know what technology power up a website? Tired of inspecting html and headers for clues? Is it WordPress? Is it Joomla? Don’t worry, simply paste the URL in the provided link and enjoy the results


ES6 Overview In 350 Bullet Points - link

A quick and easy recap of all the new features and syntax changes of ES6


Testing code that emits output and native functions in PHP - link

You know (and if you don’t, you should!!! :-), the scope of TDD is to test pieces of software to avoid that it breaks when you change something. It’s very useful because you can simply “run tests” and be sure (if you wrote and structured them correctly) that your changes didn’t affect anything. However, writing good tests is not as simple as it seems, and TDD have various type of tests (for example Unit Tests, Integration Tests, Behavior Tests and so on).

In this link we focus on Unit Tests. In Unit Tests, the difficult part is to decouple things and test all classes as separate, independent entities and test them against their interfaces. You test that, when the contract is respected (when you call their method with the correct dependencies), the class behaves as expected.

To create a successfull Unit Test, it’s very important to test objects only against their interfaces and to mock (see Mockery for php, for example) all their dependencies. With mocks, you create fake dependencies (objects) and check the correct sending/receiving on messages by/to the tested class. You focus mainly on the “communication” between the tested object and the rest of the world. With mocks, you can test a single object without having to integrate all the things together (for example, you can test a query builder without having to use a real database during the test phase).

However, when it comes to native php functions, it seems difficult to create mocked functions and objects. With this guide, you will learn some useful trick and Php language features that will help you in the building of your Unit Tests.


 

That’s all for today’s LombaXMonday, if you liked it, have any question or want to let me know that this article sucks, don’t hesitate to add a comment :-)

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>