Allowing to execute of the original logic of a mock object

When you are testing with PHPUnit you could be the need to use the real objects or mock objects, depending on what you want to test.

The mocked objects know in advance what is supposed to happen during the test and which methods will be invoked.

In most cases, you…


Automatic request content deserialization and validation

Do you ever felt like a monkey by repeating your code over and over again?

This was my situation using Symfony 5 without the support of FOSRestBundle. Decoding JSON request content and validate each field for each action of my controllers…was so frustrating!

So in the meanwhile FOSRestBundle making the…


Create a loading component using HOCs for fetching data from your server and have fun!

If you have worked with React, you have probably come across High Order Components (HOC).

A higher-order component (HOC) is an advanced technique in React for reusing component logic. HOCs are not part of the React API, per se. They are a pattern that emerges from React’s compositional nature.

A…


How to use a stream wrapper for a virtual file system and have fun!

You could be in that situation where you have to test the creation of a file or something else operation into the file system but you don’t want to mess up it.

Suppose you have to test a command that generates a CSV report file, you should make a test…


SOLID is an acronym for the first five object-oriented design (OOD) principles and is a series of guidelines that developers can use to build software in an easy way to maintain and extend. Understanding these concepts will make you a better developer and enable you to avoid code smells.

SOLID…


When you are developing your Single Page Application there is a moment when you need design the url structure too.

Usually developers use 2 types of url…

Normal Url

This is the url that we are used to seeing, with normal path, like this:

https://myspa.com/app/login
https://myspa.com/app/dashboard

This kind of url has the…


In this post we will explore the right way to use JWT token in a Single Page Application and HOW to manage it in order to avoid security issues. Read on!

Single Page Applications are become the standard of the web development architecture. One of the best methods to authenticate a user is by using JWT web token, so first of all, let’s see a general view of what is it and when you should use it!

What’s JWT token?

JSON Web Token (JWT)…


The cleanest way to deal with JSON form request

Most of times we are dealing with Ajax forms, so we need to manipulate JSON data and send it to the server. There are several ways to handle JSON requests and validate data.

I’ve seen many developers using the Validator component and their process was the following:

  • Create an entity…


There are many ways to handle exceptions and put them in your response, especially if you are developing a REST API for your project.

In most cases, when you are creating an API interface, you could need to design a JSON response structure in order to use the same format…


As you probably know if you are developing a well design project you might need to use Webpack Encore which is the simpler way to integrate Webpack in your Symfony application. …

Ideneal

Full-stack Developer & Security Enthusiast

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