Laravel developers tips

Helpful solutions for Laravel framework developers

Testing

Unit tests – complex argument matching with Mockery::on – the right way

December 1, 2018 by Marcin Nabiałek / Leave a Comment

As you probably know, writing tests is very important part of developing applications. If you don’t have them you don’t have this confidence when making changes and each time you make complex change you might break a lot of parts of application without knowing this. In my opinion in most cases feature/integration tests are the … [Read more…]

Posted in: Mockery, PHP, PhpUnit, Testing Tagged: tests argument matching, using mockery

How to make your Laravel (Dusk) tests 3 times Faster

July 23, 2018 by Marcin Nabiałek / 5 Comments

Writing tests in application is really important. Although they increase cost of application at the beginning, in longer run they save a lot of money helping you making changes in existing code base and avoiding serious problems in application after changes you made. However good tests should in my opinion should: test many details of … [Read more…]

Posted in: Laravel, Laravel Dusk, Testing Tagged: database migrations, database transactions, DatabaseMigrations, dusk performance, improve speed, laravel dusk tests speed

Running tests in Laravel Dusk

October 4, 2017 by Marcin Nabiałek / 1 Comment

Until 5.3 Laravel was offering API to create very basic Browser tests. It was possible to use assertions like assertRedirectedTo, assertViewHas and so on. But since Laravel 5.4 it was changes. Those assertions are no longer available by default. You can use laravel/browser-kit-testing package if you want to support old style tests but preferred way … [Read more…]

Posted in: Laravel, Laravel Dusk, Testing Tagged: laravel browser testing, laravel browserkit, laravel dusk chromeoptions, laravel dusk remote fonts, laravel dusk screenshots

Partial mocking and issues you don’t expect

June 30, 2016 by Marcin Nabiałek / 2 Comments

As we all know, writing tests is very useful when developing applications. But sometimes you might find issues when writing tests that are really hard to detect. If you ever got “Serialization of ‘Closure’ is not allowed” / “unserialize(): Error at offset 0 of 186 bytes in” errors when running PhpUnit together with Mockery – … [Read more…]

Posted in: Laravel, Mockery, PHP, PhpUnit, Testing Tagged: exceptions, issues, mocks

Marcin Nabiałek

Marcin Nabiałek - Certified Laravel Developer
Marcin Nabiałek - Zend Certified PHP Engineer

Categories

  • Composer
  • Eloquent
  • Laravel
  • Laravel Blade
  • Laravel Dusk
  • Laravel packages
  • Mockery
  • PHP
  • PhpUnit
  • Request
  • Testing
  • Validation

Copyright © 2023 Marcin Nabiałek