My name is Mohannad Najjar

A blog about Web Development, Software Engineering, Laravel stack, Open source and more

Fixing PHPUnit Issue: Empty lines in the output

Problem: In a zero-config running of PHPUnit, you expect the output to be something like: Where each dot represents a single test. Total of two tests in this example. You get used to it. Until suddenly you notice something strange in the output, it’s coming like this: Do you see what’s happening here? THERE IS A FEW EMPTY LINES BETWEEN EACH DOT (test) It messes up the output format in an extremely painful way....

October 31, 2020 · 2 min · Mohannad Najjar

Good APIs as a Guessing Game: Git example

I like it in npm that we can do stuff like: npm install --save first_package second_package third_package ... With the white space as a separator. Recently I discovered that we can do the same in Git for removing multiple branches at once: git branch -d first_branch second_branch third_branch ... I’m happy I discovered this feature with guessing it only, not after searching it and reading the stackoverflow post related to it....

November 19, 2017 · 2 min · Mohannad Najjar

Maybe `git submodule` can be used as a package manager?

Few days ago I wanted to include CreativeTim’s awesome project (Light Bootstrap Dashboard), into one of my bootstrap projects. The scenario is: There is existing project, existing setup for admin dashboard, but now I want it to be more like the ‘Light Bootstrap Dashboard’. Light Bootstrap Dashboard project doesn’t offer a direct way of achieving this, there is no npm package that I can pull -or maybe what I did here, is in fact the direct way of doing it?...

November 12, 2017 · 3 min · Mohannad Najjar

I don't know JavaScript: Promises & typeof null == "object"

My plan for this blog isn’t to make it a place to vent anger and frustration, don’t count this post as one, this post is about sharing learning experience and impressions. Last night I spent around 6 hours to investigate an issue in a failing javascript test, simply because I didn’t realize that this condition may ever pass: if(typeof null == 'object') .... I mean, Seriously ? that wasn’t expected at all....

October 26, 2017 · 4 min · Mohannad Najjar

Testing Vue: note on Sinon & Vue DOM Event Handler

One of the most outstanding features of vue is how templates bind event handlers to elements. alot of cool stuff that makes the template is really “cool” to read and look at! Recently I was writing a test for a Vue component, and I noticed this issue. In short, the issue is: I can’t spy on the increment method on the template: <input @click="increment">. Background: Vue offers different ways of binding event handlers to elements, for example: <input v-on:click="counter++"> or <input @click="counter++"> or <input @click="methodName" and many other options....

October 26, 2017 · 3 min · Mohannad Najjar

How I got into testing: Unit Testing

Recently I started discovering software testing tools, unit testing, end-to-end/integration/acceptance testing, test-driven-devlopment, and this whole new world to me. As a beginner, I felt it’s good to document how I got into this point. before, I was ignoring testing topics and thinks of it as a mystified world that I may or may not reach sometime in the future. Unit Testing 1- Contributing to Laravel: Oneday between November 2016 to May 2017, while I was working on a laravel 5....

October 14, 2017 · 4 min · Mohannad Najjar