Unit test Laravel pre-5.3 Queue facade

Introduction

This post is a followup of the previous one.

During my daily job I often work with old (pre 5.3) Laravel versions which do not provide fake implementations on facades, since this functionality has been introduced in version 5.3. For example with the Queue facade you can make the following assertions:

<?php

// Fake Queue functionality
Queue::fake();

// Perform order shipping...

Queue::assertPushed(ShipOrder::class, function ($job) use ($order) {
    return $job->order …
Read More
Unit test Laravel pre-5.3 Mail facade

Introduction

This post is only serving as a reference to how the Mail facade should be unit tested in Laravel versions previous to 5.3.


When testing an application we don’t want to send actual emails to users. We just want to fake them so we can ensure that they are getting sent, at some point, to the right users and with the right content.

Laravel provides Mail Fakes since version 5.3. This functionality allows you to easily mock the Mail facade and make various assertions on it. …

Read More
Use import aliases in Rollup module bundler

Introduction

Sometimes, when working with JavaScript and module bundlers, it’s useful to create aliases in order to import or require some modules more easily. In Webpack for example you can use the resolve.alias directive inside the configuration file.

module.exports = {
  //...
  resolve: {
    alias: {
      'applicationRoot': path.resolve(__dirname, 'src/')
    }
  }
};

A common use case for aliases is to abstract the application root, so instead of using relative …

Read More
Effective pagination in AdonisJS

Introduction

Notice: I already did an introduction on AdonisJs, a Laravel-inspired web framework for NodeJS. You can read that post first if you don’t know what AdonisJS is.

In the latest months I tried to get more comfortable with AdonisJS by building a concrete side-project. My impressions so far have been really positive, even though the work required to achieve some basic functionalities is higher and less intuitive compared to the effort required in Laravel. Pagination is a …

Read More
How to use presenters in AdonisJs Edge templating engine

Introduction

Being a very passionate Laravel fan, I decided to step up and finally try properly AdonisJs. I already tried some small bits of it a couple of years ago, but the generator syntax did not really appeal to me. Finally with async/await we have a battle-tested MVC framework (the current version is 4.1) with modern syntax that brings Rails/Laravel concepts to NodeJs.

The value proposition of the framework is the same that fuels modern MVC frameworks: reduce the time required to be …

Read More
Configure an infrared remote control with Linux

Introduction

Recently I bought a shiny new Intel NUC8i7HNK, equipped with 16 GB of RAM and a 500 GB SSD and I installed Ubuntu 18.04 LTS. I have to say that it works smoothly and my overall experience with it is really positive this far. I don’t really miss the MAC or Windows at all.

The Intel NUC8i7HNK comes with many different expansion options and among these, there is a front consumer infrared (CIR) sensor, so I asked myself if it was possible to control the NUC with a standard TV …

Read More