Posts

5 Quick Ways to Make Your Code More Maintainable

In Clean Code, Robert Martin gives us the following helpful piece of information.

.. [T]he ratio of time spent reading versus writing is well over 10 to 1. We are constantly reading old code as part of the effort to write new code. …[Therefore,] making it easy to read makes it easier to write.

With this in mind, we would like to give you 5 tips on how you can improve your code so it’s more readable.

Read More

Fixing the 'Target class [config] does not exist' Error

The other day I pushed a new test to our Jenkins server and I received the following error.

1) Tests\Unit\NewTest::testIfDeletedBeforeStartDateThenWrongHire
Illuminate\Contracts\Container\BindingResolutionException: Target class [config] does not exist.
 
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:805
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:681
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:629
/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:769
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:1245
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:270
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:101
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:77
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1253
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1219
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1051
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:968
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1004
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:957
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1618
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1630
/var/www/tests/TestCase.php:152
/var/www/tests/TestCase.php:116
/var/www/tests/TestCase.php:70
/var/www/tests/Unit/NewTest.php:17
/home/jenkins/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:200
/home/jenkins/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:159
 
Caused by
ReflectionException: Class config does not exist
 
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:803
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:681
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:629
/var/www/vendor/laravel/framework/src/Illuminate/Foundation/Application.php:769
/var/www/vendor/laravel/framework/src/Illuminate/Container/Container.php:1245
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:270
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:101
/var/www/vendor/laravel/framework/src/Illuminate/Database/DatabaseManager.php:77
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1253
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1219
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1051
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:968
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1004
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:957
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1618
/var/www/vendor/laravel/framework/src/Illuminate/Database/Eloquent/Model.php:1630
/var/www/tests/TestCase.php:152
/var/www/tests/TestCase.php:116
/var/www/tests/TestCase.php:70
/var/www/tests/Unit/NewTest.php:17
/home/jenkins/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:200
/home/jenkins/.composer/vendor/phpunit/phpunit/src/TextUI/Command.php:159

The issue was that I had forgotten to include parent::setup() in the test class’ setup() function.

What the F*ck Is With All the Artisan Commands: Queues

Work queues allow you to perform tasks that are slow or error-prone outside of the current user’s request to improve their experience with your site. Read on to learn how you can use work queues in Laravel for your projects.

Read More

Link Post and Podcast Roundup: March 2020 Edition

March’s links.

Read More

Installing Existing VS Code Extensions on a New Computer

I recently purchased a new computer and realized there isn’t an easy way in the VS Code GUI to get a list of all of your installed extensions. I was able to find a way to do it using the command line.

Read More

What the F*ck Is With All the Artisan Commands: Route Commands

There are three route commands that we need to quickly cover in order to be completionist in this process of going over every artisan command.

Read More

What the F*ck Is With All the Artisan Commands: Seeders

Now that we have discussed creating factories, we can look at how to use these factories to seed our database with test data.

Read More

Link Post and Podcast Roundup: February 2020 Edition

Link Post Logo

February’s links.

Read More

What the F*ck Is With All the Artisan Commands: Factories

Now that we know how to create tests, it’s time we looked at how we can use factories to generate test data quickly and easily.

Read More

Our New Mailing List!

Our New Mailing List Header Image

We’ve started a new mailing list to communicate new content and links to the community. You can sign up using the form below. We don’t like having our inbox filled up with SPAM so you can be assured that we won’t be sending you any. 😆

Subscribe

* indicates required

View previous campaigns.

Join Our Mailing List!

View previous campaigns.

subscribe via RSS

All content copyright This Programming Thing 2012 - 2020
Blogging about PHP, MySQL, Zend Framework, MySQL, Server Administration and Programming in general