Most web developers cringe when they hear of TDD (test driven development). Well, I did when I was asked to program with TDD first.
When you are starting off, it feels overwhelming. If you resist it, it will make it harder for you to learn it. So what should you do? Embrace it. Well, it has reason why it is there. There will always be debates on technology, whether the programming language or the process you will use to develop software.
Some may agree that XP or Xtreme Programming is better than TDD and vise-versa. It will really boils down…
You need to start TDD in NodeJS right now! Some asks why? I ask, why not?
I started writing the TDD in Laravel — currently the most famous PHP web framework, with simple instructions on how to start a PHP programmer’s test driven development journey. Now, I would like to share how we can have the same pattern in NodeJs.
In any programming language, test driven development can be really daunting. …
Many applications, back in the day, were made with native windows client. A user will just have to click a desktop icon and voila! Ready to use app. Fast track today, most of the applications are already in the “cloud” and is web based.
With the delightful experience of programmers around the world using the web technology for creating stunning…
I would still use my carousel example from the previous article.
In testing the feature of your application, make sure you segregate the admin UI from the front office UI testing. For my example, I namespace it with
Right now, our focus is the admin panel carousel CRUD. Let’s write the test now.
Let’s break this down a bit.
As part II of the CRUD Unit Testing in Laravel 5, we continue with negative testing.
What we have in the previous article is testing the positive side; say it CAN create, update, show or delete the carousel we are trying to do.
Now let us test the opposite, what if it fails and how we handle it?
Remember, when we create our migration file,
we set the link as nullable but the title and the src are NOT NULL.
So, we expect here that the database should throw an error when those columns are null right? …
When starting this project, I have to think of the long term so never in my mind that I will not use the TDD (test driven development) approach, it is a MUST. So in doing it, I need my tests to be separated in two different groups, one for Unit testing and one for Feature testing.
Unit testing is testing your classes — Models, Repositories etc. while Feature testing is testing your code if it hits…
Laravel passport is a great package to authenticate your user to your web or mobile app. It uses the OAuth2 package by phpleague underneath. It should solve most of the API developers problem on the authentication side.
While Laravel Passport is useful to most developers, it is still a puzzle on how to authenticate multiple (user) models within it since underneath(by default), it looks on the
users table only.
A recent update on the package allows you to specify a custom provider so you can hack a bit on the framework to look on which table in the database.
Check it out in my Github account — https://github.com/jsdecena/laravel-passport-mutiauth
Last time, I wrote an article to get your feet wet on Test Driven Development (TDD). You may refer to this post: Simple TDD in Laravel with 11 steps
Today, let us refactor what we have accomplished on that post to make it more manageable. We will use the REPOSITORY pattern. With this way, methods are reusable in the other parts of the application by doing Dependency Injection (DI).
Fork my TDD e-commerce application: https://github.com/jsdecena/laracom (check out the `/tests` folder)
Edit: I created a base repository package that can speed up your development :)
Let’s review the test we have…
Senior Fullstack Engineer